PATH:
home
/
letacommog
/
letaweb
/
admin
/
models
/
subsite_models
/
forms
<?php class ProfileResetPassForm extends CFormModel { public $id; public $password; public $confirm_password; public $current_password; /** * @return array customized attribute labels (name=>label) */ public function attributeLabels() { return array( 'password' => 'Password', 'confirm_password' => 'Confirm password', ); } public function rules() { return array( array('current_password', 'current_password'), array('confirm_password, password', 'required'), array('password', 'length', 'min' => 6), array('confirm_password', 'length', 'min' => 6), array('password', 'compare', 'compareAttribute' => 'confirm_password'), array('id, confirm_password, password', 'safe'), ); } public function save($item = null) { if ($this->validate()) { $user = User_Admin::model()->findByPk(Yii::app()->user->id); $user->password = crypt($this->password, Randomness::blowfishSalt()); // $user->save(); return true; } else { return false; } } public function current_password() { $user = User_Admin::model()->findByPk(Yii::app()->user->id); if ($user == null) { return false; } if (crypt($this->current_password, $user->password) !== $this->current_password) { $this->addError('password', Yii::t('Don', 'Current password is invalid.', array('{password}' => $this->password))); return false; } return true; } }
[+]
..
[-] ColorForm.php
[edit]
[-] ProfileResetPassForm.php
[edit]
[-] NewsCommentForm.php
[edit]
[-] SkinForm.php
[edit]
[-] PageForm.php
[edit]
[-] BLoginForm.php
[edit]
[-] UserResetPassForm.php
[edit]
[-] ModuleForm.php
[edit]
[-] NewsForm.php
[edit]
[-] ContributorForm.php
[edit]
[-] News_CategoriesForm.php
[edit]
[-] InviteForm.php
[edit]
[-] NewsTagForm.php
[edit]
[-] DomainForm.php
[edit]