public function _process() { appMakeTemplateReady($this->template); $v = new v6_validator($_POST, $this->template); $v->check_string('first_name', 'First Name', 2, 25, true); $v->check_string('last_name', 'Last Name', 2, 25, true); $v->check_email('email', 'E-Mail Address', true); $v->check_password('passwd', 'Password', 4, 20, true, false); if (empty($v->message) == false) { $this->template->message = 'Please fix input errors.'; $this->template->show('signup.form'); } else { if ($this->template->user->is_dupe_email($_POST['email']) == true) { $this->template->message = 'Please correct input errors below.'; $this->template->email_hint = 'Account already exists with this email address.'; $this->template->show('signup.form'); } else { $this->template->user->first_name = $_POST['first_name']; $this->template->user->last_name = $_POST['last_name']; $this->template->user->email = strtolower($_POST['email']); $this->template->user->passwd = $_POST['passwd']; $this->template->user->save(); $this->template->message = 'Account created successfully. You may now login'; $this->template->show('login.form'); } } }
public function _process() { appMakeTemplateReady($this->template); $v = new v6_validator($_POST, $this->template); $v->check_email('email', 'E-Mail Address', true); $v->check_password('passwd', 'Password', 4, 20, true, false); if (empty($v->message) == false) { $this->template->message = 'Please fix input errors.'; $this->template->show('login.form'); } else { $acl = new v6_acl('users', 'email', 'passwd'); if ($acl->authenticate($_POST['email'], $_POST['passwd']) == true) { $this->json['mgr_before'] = clone $this->template->mgr; // user provided good credentials $this->template->mgr->update($acl->user_table->id); header('location: /'); } else { // user blew it $this->template->message = 'Login Failed'; $this->template->show('login.form'); } } }