CC-3110 : Password reset

This commit is contained in:
Naomi Aro 2011-12-27 14:33:22 -08:00
parent 52b0e3c5f9
commit 53d504f26e
3 changed files with 9 additions and 6 deletions

View File

@ -24,7 +24,7 @@ class AuthController extends Zend_Controller_Action
$auth = new Application_Model_Auth();
$auth->sendPasswordRestoreLink($user, $this->view);
//$this->_helper->redirector('password-restore-after', 'auth');
$this->_helper->redirector('password-restore-after', 'auth');
}
else {
$form->email->addError($this->view->translate("Given email not found."));

View File

@ -12,7 +12,7 @@ class Application_Model_Auth {
$info = new CcSubjsToken();
$info->setDbUserId($user_id);
$info->setDbAction($action);
$info->setDbToken(sha1($token + $salt));
$info->setDbToken(sha1($token.$salt));
$info->setDbCreated(gmdate('Y-m-d H:i:s'));
$info->save();
@ -23,12 +23,15 @@ class Application_Model_Auth {
{
$token = $this->generateToken('password.restore', $user->getDbId());
$e_link = $view->url(array('user_id' => $user->getDbId(),
$e_link_protocol = empty($_SERVER['HTTPS']) ? "http" : "https";
$e_link_base = $_SERVER['SERVER_NAME'];
$e_link_path = $view->url(array('user_id' => $user->getDbId(),
'token' => $token
),
'password-change');
$message = "Click this link: {$e_link}";
$message = "Click this link: {$e_link_protocol}://{$e_link_base}{$e_link_path}";
Application_Model_Email::send('Airtime Password Reset', $message, $user->getDbEmail());
}
@ -47,7 +50,7 @@ class Application_Model_Auth {
$token_info = CcSubjsTokenQuery::create()
->filterByDbAction($action)
->filterByDbUserId($user_id)
->filterByDbToken(sha1($token + $salt))
->filterByDbToken(sha1($token.$salt))
->findOne();
if (empty($token_info)) {

View File

@ -25,7 +25,7 @@ class Application_Model_Email {
$mail = new Zend_Mail('utf-8');
$mail->setSubject($subject);
$mail->setBodyText($message);
$mail->setFrom(isset($from) ? $from : 'naomiaro@gmail.com');
$mail->setFrom(isset($from) ? $from : 'naomi.aro@sourcefabric.org');
foreach ((array) $tos as $to) {
$mail->addTo($to);