I have the following encryption on the password when a user registers:
public function actionCreate()
{
$model=new Users;
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['Users']))
{
$model->attributes=$_POST['Users'];
// how many times the string will be hashed
$rounds = 10000;
// @todo Use real salt here.
$salt = 'salt';
// pass in the password, the number of rounds, and the salt
// $5$ specifies SHA256-CRYPT, use $6$ if you really want SHA512
$model->PassWord=crypt($model->PassWord, sprintf('$6$rounds=%d$%s$', $rounds, $salt));
if($model->save())
$this->redirect(array('view','id'=>$model->users_id));
}
$this->render('create',array(
'model'=>$model,
));
}
Now I know the code I need to change to authenticate users is this:
else if($user->PassWord!==$this->password)
and if I was using the crypt method I would normally use this:
else if($user->PassWord!==crypt($this->password,'salt'))
How do I change the login script to use sha512?