public function rules() { $rules = parent::rules(); $rules[] = ['captcha', 'required']; $rules[] = ['captcha', 'captcha']; return $rules; }
public function rules() { $rules = parent::rules(); $rules['usernameLength'] = ['username', 'string', 'min' => 3, 'max' => 255]; $rules[] = ['name', 'required']; return $rules; }
public function rules() { $rules = parent::rules(); $rules['direccionRequired'] = ['direccion', 'required']; $rules['direccionLength'] = ['direccion', 'string', 'max' => 255]; $rules['latitudRequired'] = ['latitud', 'required']; $rules['longitudRequired'] = ['longitud', 'required']; return $rules; }
/** * @inheritdoc */ public function rules() { $rules = parent::rules(); $rules[] = ['name', 'required']; $rules[] = ['name', 'string', 'max' => 255]; $rules[] = ['passwordConfirm', 'string']; $rules[] = ['passwordConfirm', 'required']; return $rules; }
/** * @inheritdoc */ public function rules() { $rules = parent::rules(); $rules[] = ['verifyCode', 'required']; $rules[] = ['verifyCode', 'captcha']; $userClass = $this->module->modelMap['User']; $rules = $userClass::addSharedRules($rules); $rules['usernameBlacklist'] = ['username', 'validateUsernameBlacklist']; return $rules; }
/** * @inheritdoc */ public function rules() { $rules = parent::rules(); $rules[] = [['firstname', 'lastname', 'birthday', 'terms'], 'required']; $rules[] = [['firstname', 'lastname'], 'string', 'max' => 255]; $rules[] = [['birthday'], 'safe']; $rules[] = ['birthday', 'date', 'format' => 'yyyy-mm-dd']; $rules[] = ['captcha', 'captcha']; $rules[] = ['terms', 'required', 'requiredValue' => true, 'message' => 'You must agree to the terms and conditions']; return $rules; }
public function rules() { // $user = $this->module->modelMap['User']; $rules = parent::rules(); //Title Rules $rules['titleidRequired'] = ['title_id', 'required']; $rules['titleidInteger'] = ['title_id', 'integer']; //First name Rules $rules['firstnameRequired'] = ['firstname', 'required']; $rules['firstnameTrim'] = ['firstname', 'filter', 'filter' => 'trim']; $rules['firstnameLength'] = ['firstname', 'string', 'min' => 2, 'max' => 100]; $rules['firstnamePattern'] = ['firstname', 'match', 'pattern' => Pattern::getPattern('name')]; //Last name Rules $rules['lastnameTrim'] = ['lastname', 'filter', 'filter' => 'trim']; $rules['lastnameLength'] = ['lastname', 'string', 'min' => 2, 'max' => 100]; $rules['lastnamePattern'] = ['lastname', 'match', 'pattern' => Pattern::getPattern('name')]; // Check Language for firstname and lastname $rules['checkLanguage'] = [['firstname', 'lastname'], 'checkLanguage', 'skipOnEmpty' => false, 'skipOnError' => false, 'when' => function ($model) { return trim($model->lastname) != ''; }]; //ID Number Rules $rules['idcardString'] = ['idcard', 'string', 'length' => 13]; $rules['idcardTrim'] = ['idcard', 'filter', 'filter' => 'trim']; $rules['idcardPattern'] = ['idcard', 'match', 'pattern' => Pattern::getPattern('idcard')]; $rules['idcardRequired'] = ['idcard', 'required']; $rules['idcardUnique'] = ['idcard', 'unique', 'targetClass' => Profile::className(), 'message' => Yii::t('user', 'This Phone Number has already been taken')]; //Phone Rules $rules['phoneString'] = ['phone', 'string', 'min' => 9, 'max' => 10]; $rules['phoneTrim'] = ['phone', 'filter', 'filter' => 'trim']; $rules['phonePattern'] = ['phone', 'match', 'pattern' => Pattern::getPattern('phone')]; //Passcode Rules $rules['passcodeString'] = ['passcode', 'string', 'max' => 255]; $rules['passcodeRequired'] = ['passcode', 'required']; $rules['passcodeValidate'] = ['passcode', function ($attr) { if (!($this->{$attr} === $this->_code)) { $this->addError($attr, Yii::t('user', 'Your Given Passcode is not correct')); } }]; return $rules; }
/** * @inheritdoc */ public function rules() { $rules = parent::rules(); $rules['passwordLength']['min'] = User::PASSWORD_MIN_LENGTH; return $rules; }
/** @inheritdoc */ public function rules() { $rules = [['telephone', 'filter', 'filter' => 'trim'], ['telephone', 'match', 'pattern' => '/^[0-9]+$/'], ['telephone', 'required'], ['telephone', 'unique', 'targetClass' => $this->module->modelMap['User'], 'message' => \Yii::t('user', 'Этот номер телефона уже используется.')], ['telephone', 'string', 'min' => 11, 'max' => 20]]; return array_merge(parent::rules(), $rules); }
/** * @inheritdoc */ public function rules() { return array_replace(parent::rules(), ['usernameRequired' => ['username', 'safe'], 'usernameUnique' => ['username', 'safe']]); }
public function rules() { return ArrayHelper::merge(parent::rules(), [['repeat_password', 'required'], ['repeat_password', 'compare', 'compareAttribute' => 'password'], ['first_name', 'required'], ['first_name', 'string', 'max' => 255], ['last_name', 'required'], ['last_name', 'string', 'max' => 255], ['country', 'required'], ['country', 'string', 'max' => 2], ['verifyCodeReg', 'captcha', 'captchaAction' => '/user/registration/captcha', 'enableClientValidation' => false]]); }