function getUser($email = '*****@*****.**') { if (DB\countRows('users', "email = ?", array($email)) == 0) { return newUser($email, 'big-joe-' . time(), 'something'); } else { return User::loadFromEmailAddr($email); } }
function lostPass() { $noSuchAccount = false; $email = at($_POST, 'email', null); if ($email) { try { $user = User::loadFromEmailAddr($email); $confCode = ConfCodes\generateAndSave($user); $this->sendPassResetEmail($email, $confCode); /* $this->saveInSession('passwordResetEmailSent', true); return $this->redirect('/account/signin'); */ return $this->successMessage("<strong>We've sent you an email!</strong> Please check your inbox " . "and look for a link there that will help you reset your password."); } catch (NoSuchUser $_) { $noSuchAccount = true; } } return $this->render('account/lost-pass.diet-php', array('noSuchAccount' => $noSuchAccount, 'invalidConfCode' => $this->takeFromSession('invalidConfCode'))); }