public function reset_new() { $linkData = $this->linkData($_POST['link']); if ($linkData['error'] > 0) { \ipinga\cookie::add('message_for_next_screen', $linkData['message']); header('location: /login'); } else { $v = new \ipinga\validator($_POST, true); $v->checkPassword('passwd1', 'Password', 4, 20, true, false); $v->checkMatch('passwd1', 'passwd2', 'Passwords'); if (empty($v->message) == false) { $this->template->message = 'Please fix input errors.'; $this->template->user = $linkData['user']; $this->template->link = $_POST['link']; $this->template->show('password.reset.form'); } else { /** @var \ipinga\userTable $u */ $u = $linkData['user']; $u->passwd = $_POST['passwd1']; $u->save(); \ipinga\cookie::add('message_for_next_screen', 'Your password has been changed. You may now login.'); header('location: /login'); } } }
public function post() { $v = new \ipinga\validator($_POST, true); $v->checkEmail('email', 'E-Mail Address', true); $v->checkPassword('passwd', 'Password', 4, 20, true, false); if (empty($v->message) == false) { $this->template->message = 'Please fix input errors.'; $this->template->show('login.form'); } else { if (\ipinga\acl::authenticate($_POST['email'], $_POST['passwd']) == true) { // user provided good credentials \ipinga\ipinga::getInstance()->manager->update(\ipinga\acl::$userTable->id); header('location: /'); } else { // user blew it $this->template->message = 'Login Failed: Either your email address or password is incorrect.'; $this->template->show('login.form'); } } }