Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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...
commit 51cacbf76c6a919a911ce1aaf5a7e1a7ec326c98 2 parents 3405236 + 9156d78
@samdark samdark authored
View
5 demos/blog/protected/controllers/SiteController.php
@@ -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);
}
-}
+}
View
BIN  demos/blog/protected/data/blog-test.db
Binary file not shown
View
BIN  demos/blog/protected/data/blog.db
Binary file not shown
View
1  demos/blog/protected/models/User.php
@@ -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
*/
View
15 demos/blog/protected/tests/unit/UserTest.php
@@ -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'));
+
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.