Permalink
Browse files

Merge branch '1819-demo-blog-auth' of git://github.com/mytskine/yii i…

…nto mytskine-1819-demo-blog-auth

Conflicts:
	demos/blog/protected/data/blog.db
  • Loading branch information...
2 parents 3405236 + 9156d78 commit 51cacbf76c6a919a911ce1aaf5a7e1a7ec326c98 @samdark samdark committed Dec 19, 2012
@@ -62,6 +62,9 @@ public function actionContact()
*/
public function actionLogin()
{
+ if (!defined('CRYPT_BLOWFISH')||!CRYPT_BLOWFISH)
+ throw new CHttpException(500,"This application requires that PHP was compiled with Blowfish support for crypt().");
+
$model=new LoginForm;
// if it is ajax validation request
@@ -91,4 +94,4 @@ public function actionLogout()
Yii::app()->user->logout();
$this->redirect(Yii::app()->homeUrl);
}
-}
+}
Binary file not shown.
Binary file not shown.
@@ -7,7 +7,6 @@ class User extends CActiveRecord
* @var integer $id
* @var string $username
* @var string $password
- * @var string $salt
* @var string $email
* @var string $profile
*/
@@ -6,8 +6,19 @@ class UserTest extends CDbTestCase
'users'=>'User',
);
- public function testCreate()
+ public function testValidatePassword()
{
+ $this->assertTrue($this->users(0)->validatePassword('demo'));
+ $this->assertFalse($this->users(0)->validatePassword('wrong'));
}
-}
+
+ public function testChangePassword()
+ {
+ $user=$this->users(0);
+ $user->password=$user->hashPassword('newpwd');
+ $this->assertFalse($user->validatePassword('demo'));
+ $this->assertTrue($user->validatePassword('newpwd'));
+
+ }
+}

0 comments on commit 51cacbf

Please sign in to comment.