Skip to content

Commit

Permalink
Fixed issue: No way to reset a forgotten password
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed Apr 24, 2013
1 parent 2017a69 commit 512dcd2
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions application/models/User.php
Expand Up @@ -242,23 +242,26 @@ public function getuidfromparentid($parentid)
* @access public
* @return string
*/
public function getID($fullname)
public function getID($sUserName)
{
return $this->db->createCommand()->select('uid')
->from('users')
->where(array("full_name"=>Yii::app()->db->quoteValue($fullname)))
->queryScalar();
$oUser = User::model()->findByAttributes(array(
'users_name' => $sUserName
));
if ($oUser)
{
return $oUser->uid;
}
}

/**
* Updates user password hash
*
* @param int $uid The User ID
* @param int $iUserID The User ID
* @param string $sPassword The clear text password
*/
public function updatePassword($uid, $sPassword)
public function updatePassword($iUserID, $sPassword)
{
return $this->updateByPk($uid, array('password' => hash('sha256', $sPassword)));
return $this->updateByPk($iUserID, array('password' => hash('sha256', $sPassword)));
}

/**
Expand Down

0 comments on commit 512dcd2

Please sign in to comment.