Yii Framework Forum: Property "User.salt" is not defined. - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Property "User.salt" is not defined. newbee Rate Topic: ***** 1 Votes

#1 User is offline   ibbrxx 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 20-March 10
  • Location:Maldives

Posted 20 March 2010 - 03:43 AM

here the error message i get:
CException
Description

Property "User.salt" is not defined.
Source File

C:\wamp\www\yii\framework\db\ar\CActiveRecord.php(107)

00095: */
00096: public function __get($name)
00097: {
00098: if(isset($this->_attributes[$name]))
00099: return $this->_attributes[$name];
00100: else if(isset($this->getMetaData()->columns[$name]))
00101: return null;
00102: else if(isset($this->_related[$name]))
00103: return $this->_related[$name];
00104: else if(isset($this->getMetaData()->relations[$name]))
00105: return $this->getRelated($name);
00106: else
00107: return parent::__get($name);
00108: }
00109:
00110: /**
00111: * PHP setter magic method.
00112: * This method is overridden so that AR attributes can be accessed like properties.
00113: * @param string property name
00114: * @param mixed property value
00115: */
00116: public function __set($name,$value)
00117: {
00118: if($this->setAttribute($name,$value)===false)
00119: {

Stack Trace

#0 C:\wamp\www\yii\framework\db\ar\CActiveRecord.php(107): CComponent->__get('salt')
#1 C:\wamp\www\blog\protected\models\User.php(101): CActiveRecord->__get('salt')
#2 C:\wamp\www\blog\protected\components\UserIdentity.php(18): User->validatePassword('demo')
#3 C:\wamp\www\blog\protected\models\LoginForm.php(52): UserIdentity->authenticate()
#4 C:\wamp\www\yii\framework\validators\CInlineValidator.php(39): LoginForm->authenticate('password', Array)
#5 C:\wamp\www\yii\framework\validators\CValidator.php(176): CInlineValidator->validateAttribute(Object(LoginForm), 'password')
#6 C:\wamp\www\yii\framework\base\CModel.php(150): CValidator->validate(Object(LoginForm), NULL)
#7 C:\wamp\www\blog\protected\controllers\SiteController.php(88): CModel->validate()
#8 C:\wamp\www\yii\framework\web\actions\CInlineAction.php(32): SiteController->actionLogin()
#9 C:\wamp\www\yii\framework\web\CController.php(300): CInlineAction->run()
#10 C:\wamp\www\yii\framework\web\CController.php(278): CController->runAction(Object(CInlineAction))
#11 C:\wamp\www\yii\framework\web\CController.php(257): CController->runActionWithFilters(Object(CInlineAction), Array)
#12 C:\wamp\www\yii\framework\web\CWebApplication.php(320): CController->run('login')
#13 C:\wamp\www\yii\framework\web\CWebApplication.php(120): CWebApplication->runController('site/login')
#14 C:\wamp\www\yii\framework\base\CApplication.php(135): CWebApplication->processRequest()
#15 C:\wamp\www\blog\index.php(12): CApplication->run()
#16 {main}

2010-03-20 13:35:57 Apache/2.2.11 (Win32) PHP/5.2.9-1 Yii Framework/1.1.1
0

#2 User is offline   ekerazha 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 526
  • Joined: 10-October 08
  • Location:European Union

Posted 20 March 2010 - 07:06 AM

You are trying to use the "salt" field but there isn't any "salt" field for your model class
Yii user #37
0

#3 User is offline   backwardselvis 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 19
  • Joined: 24-February 10
  • Location:Bend, OR

Posted 20 March 2010 - 01:48 PM

ibbrxx,

Ekerazha is correct, you need to add the attribute into your model.

...
public $salt;
..


Abovie is an insanely basic example, but give it a whirl. Post your model/User.php file if you still are having issues.
0

#4 User is offline   ibbrxx 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 20-March 10
  • Location:Maldives

Posted 21 March 2010 - 12:22 AM

cheers to you quick support guys....got hold of the problem now. I AM LOVING THIS NEW YII BABY
0

#5 User is offline   monk 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 12
  • Joined: 22-March 11

Posted 04 May 2011 - 08:08 AM

Yap, the above field definition works. I just used it in my app and was able to resolve this problem. Thanks guys.
0

#6 User is offline   channasmcs 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 86
  • Joined: 06-March 13
  • Location:Srilanka

Posted 12 August 2013 - 11:04 AM

 backwardselvis, on 20 March 2010 - 01:48 PM, said:

ibbrxx,

Ekerazha is correct, you need to add the attribute into your model.

...
public $salt;
..


Abovie is an insanely basic example, but give it a whirl. Post your model/User.php file if you still are having issues.


ys that ture this working well
0

#7 User is offline   zdzisius 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 05-November 13

Posted 05 November 2013 - 05:19 PM

hello there !

I got the same problem. I tried to practice of making blog from tutotial. I recived message 'Property "User.salt" is not defined'. I added field public $salt; into class User, then i couldn't logged in, message: Incorrect username or password.
Blog should has authentification: demo, demo (from database). I used schema.mysql from demo/blog.
0

#8 User is offline   Ha Loan 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 20-February 14

Posted 20 February 2014 - 11:11 AM

 zdzisius, on 05 November 2013 - 05:19 PM, said:

hello there !

I got the same problem. I tried to practice of making blog from tutotial. I recived message 'Property "User.salt" is not defined'. I added field public $salt; into class User, then i couldn't logged in, message: Incorrect username or password.
Blog should has authentification: demo, demo (from database). I used schema.mysql from demo/blog.

0

#9 User is offline   tianyingnan 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 23-April 14

Posted 23 April 2014 - 11:36 PM

请参考,如有帮助请留下”脚印"
Please reference, if it helps, please leave your footprints

http:
//hi.baidu.com/tianyingnan/item/f3010afa55dd48d643c36a68
0

#10 User is offline   jkofsky 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 536
  • Joined: 17-May 10
  • Location:Pensacola, Florida

Posted 24 April 2014 - 02:25 AM

 zdzisius, on 05 November 2013 - 05:19 PM, said:

hello there !

I got the same problem. I tried to practice of making blog from tutotial. I recived message 'Property "User.salt" is not defined'. I added field public $salt; into class User, then i couldn't logged in, message: Incorrect username or password.
Blog should has authentification: demo, demo (from database). I used schema.mysql from demo/blog.

The salt HAS to be in the User table and set in create user. That way when the user logs in the hash will always have the same salt value to add to the password to get the correct match value.
Do, or do not. There is no 'try.' Jedi Master Yoda
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users