web part of Bashgid
This commit is contained in:
1 parent
4ef60e1aa0
commit
5c5238c85f
155 files changed
+7956
No files matched your search
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
class User extends CActiveRecord {
|
||||
|
||||
public $verifyCode;
|
||||
|
||||
public static function model($className = __CLASS__)
|
||||
{
|
||||
return parent::model($className);
|
||||
}
|
||||
|
||||
public function tableName()
|
||||
{
|
||||
return 'tbl_user';
|
||||
}
|
||||
|
||||
public function rules()
|
||||
{
|
||||
return array(
|
||||
array('username, password, email', 'required', 'message' => '{attribute} ' . Yii::t('app', 'Field should not be blank')),
|
||||
array('username, password, email', 'length', 'max' => 100, 'tooLong' => '{attribute} ' . Yii::t('app', 'Line is too long')),
|
||||
array('email', 'email', 'message' => Yii::t('app', 'Email address is not correct')),
|
||||
array('username, email', 'unique'),
|
||||
array('verifyCode', 'captcha', 'allowEmpty' => false, 'message' => Yii::t('app', 'Confirmation code is not correct')),
|
||||
);
|
||||
}
|
||||
|
||||
public function unique($attribute, $params)
|
||||
{
|
||||
|
||||
if (!$this->hasErrors())
|
||||
{
|
||||
$count = user::model()->count($attribute . '=:attribute', array('attribute' => $this->attributes[$attribute]));
|
||||
if ($count != 0)
|
||||
$this->addError($attribute, Yii::t('app', 'User {attribute} is already registered in system'), array('{attribute}' => $this->attributes[$attribute]));
|
||||
}
|
||||
}
|
||||
|
||||
function attributeLabels()
|
||||
{
|
||||
return array(
|
||||
'username' => Yii::t('app', 'Username:'),
|
||||
'password' => Yii::t('app', 'Password:'),
|
||||
'email' => Yii::t('app', 'Email:'),
|
||||
'verifyCode' => Yii::t('app', 'Confirmation code:'),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user