Example #1
0
 public function rules()
 {
     $rules = array(array('gs_id,login,password,re_password,email', 'filter', 'filter' => 'trim'), array('gs_id,login,password,re_password,email', 'required'), array('login', 'length', 'min' => Users::LOGIN_MIN_LENGTH, 'max' => Users::LOGIN_MAX_LENGTH), array('password', 'length', 'min' => Users::PASSWORD_MIN_LENGTH, 'max' => Users::PASSWORD_MAX_LENGTH), array('re_password', 'length', 'min' => Users::PASSWORD_MIN_LENGTH, 'max' => Users::PASSWORD_MAX_LENGTH), array('re_password', 'compare', 'compareAttribute' => 'password', 'message' => Yii::t('main', 'Поля «{compareAttribute}» и «{attribute}» не совпадают.')), array('email', 'email', 'message' => Yii::t('main', 'Введите корректный Email адрес.')), array('email', 'checkBadEmail'), array('login', 'checkLoginChars'), array('gs_id', 'gsIsExists'), array('login', 'loginUnique'));
     // Captcha
     $captcha = config('register.captcha.allow') && CCaptcha::checkRequirements();
     if ($captcha) {
         $rules[] = array('verifyCode', 'filter', 'filter' => 'trim');
         $rules[] = array('verifyCode', 'required');
         $rules[] = array('verifyCode', 'validators.CaptchaValidator');
     }
     // Prefix
     if (config('prefixes.allow') && config('prefixes.length') > 0 && config('prefixes.count_for_list') > 0) {
         $rules[] = array('prefix', 'filter', 'filter' => 'trim');
         $rules[] = array('prefix', 'required');
         $rules[] = array('prefix', 'checkPrefix');
     }
     // Referral program
     if (config('referral_program.allow')) {
         $rules[] = array('referer', 'filter', 'filter' => 'trim');
         $rules[] = array('referer', 'length', 'allowEmpty' => TRUE, 'min' => Users::REFERER_MIN_LENGTH, 'max' => Users::REFERER_MAX_LENGTH);
         $rules[] = array('referer', 'refererIsExists');
     }
     // Unique email
     if (!config('register.multiemail')) {
         $rules[] = array('email', 'emailUnique');
     }
     return $rules;
 }
Example #2
0
 /**
  * @return array validation rules for model attributes.
  */
 public function rules()
 {
     // NOTE: you should only define rules for those attributes that
     // will receive user inputs.
     $rules = array(array('nombre,apellido,username,email,rolid, nivelid, activo', 'required'), array('activo', 'numerical', 'integerOnly' => true), array('activo', 'default', 'value' => 1), array('username', 'length', 'max' => 15, 'min' => 3), array('username', 'unique'), array('username', 'match', 'pattern' => '/^[A-Za-z0-9_]+$/u'), array('password', 'length', 'max' => 128, 'min' => 4), array('password,verifyPassword', 'required'), array('password', 'compare', 'compareAttribute' => 'verifyPassword'), array('nombre, apellido', 'length', 'max' => 30), array('email', 'length', 'max' => 60), array('email', 'unique'), array('email', 'email'), array('verifyCode', 'captcha', 'allowEmpty' => !CCaptcha::checkRequirements()), array('rolid, nivelid, dependid', 'length', 'max' => 11), array('id, username, password, nombre, apellido, email, rolid, nivelid, activo, dependid', 'safe', 'on' => 'search'));
     return $rules;
 }
Example #3
0
 public function rules()
 {
     $obj = new CHtmlPurifier();
     $obj->options = array('HTML.Allowed' => '');
     $obj = array($obj, 'purify');
     return array(array('verifyCode', 'captcha', 'allowEmpty' => !Yii::app()->user->isGuest || !CCaptcha::checkRequirements()), array('name, email, message', 'required', 'message' => '{attribute} должен быть заполнен'), array('email', 'email', 'message' => "Неправильно указан email"), array('name, email, message', 'filter', 'filter' => $obj));
 }
Example #4
0
 /**
  * Declares the validation rules.
  * The rules state that username and password are required,
  * and password needs to be authenticated.
  */
 public function rules()
 {
     $obj = new CHtmlPurifier();
     $obj->options = array('HTML.Allowed' => '');
     $obj = array($obj, 'purify');
     return array(array('verifyCode', 'captcha', 'allowEmpty' => !Yii::app()->user->isGuest || !CCaptcha::checkRequirements()), array('email, password', 'required'), array('rememberMe', 'boolean'), array('password', 'authenticate'), array('email, verifyCode', 'filter', 'filter' => $obj));
 }
Example #5
0
 public function behaviors()
 {
     if (Yii::app()->controller->module->captcha !== null && CCaptcha::checkRequirements()) {
         return array('captcha' => array('class' => 'CaptchaFormBehavior', 'ruleOptions' => array('except' => 'reset,verify')));
     }
     return array();
 }
	public function rules() 
	{
		$rules = parent::rules();

		/* FIXME: As soon as i grasp how i can dynamically add variables to a 
			 class in PHP, i will enable this code snippet for flexibility:

			 $profile = new YumProfile;
			 $profile_rules = $profile->rules();
			 foreach($profile_rules as $rule) 
			 if(isset($rule[0]) && is_string($rule[0]))
			 $this->${$rule[0]} = ''; 

			 $rules = array_merge($rules, $profile->rules());	 */

		$rules[] = array('username', 'required');
		$rules[] = array('password, verifyPassword', 'required');
		$rules[] = array('password', 'compare',
				'compareAttribute'=>'verifyPassword',
				'message' => Yum::t("Retype password is incorrect."));
		if(Yum::module('registration')->enableCaptcha)
			$rules[] = array('verifyCode', 'captcha',
					'allowEmpty'=>CCaptcha::checkRequirements()); 

		return $rules;
	}
Example #7
0
 public function isCaptchaEnabled()
 {
     $module = Yii::app()->getModule('user');
     if (!$module->showCaptcha || !CCaptcha::checkRequirements() || $this->disableCaptcha) {
         return false;
     }
     return true;
 }
Example #8
0
 /**
  * @return array validation rules for model attributes.
  */
 public function rules()
 {
     $obj = new CHtmlPurifier();
     $obj->options = array('HTML.Allowed' => '');
     // NOTE: you should only define rules for those attributes that
     // will receive user inputs.
     return array(array('verifyCode', 'captcha', 'allowEmpty' => !Yii::app()->user->isGuest || !CCaptcha::checkRequirements()), array('email', 'email', 'message' => "Email неверный"), array('email', 'unique', 'message' => 'Email уже зарегистрирован!'), array('name, password, email ', 'required', 'message' => '{attribute} обязательно для заполнения!'), array('summ_buy, summ_exit, summ_limit, activate_email, activate_phone', 'numerical', 'integerOnly' => true), array('name, password, password_repeat, email, phone, role', 'length', 'max' => 125, 'message' => '{attribute} длинна строки не должна превышшать 125 символов'), array('name, email, phone', 'filter', 'filter' => array($obj, 'purify')));
 }
Example #9
0
 /**
  * @return array validation rules for model attributes.
  */
 public function rules()
 {
     // NOTE: you should only define rules for those attributes that
     // will receive user inputs.
     $obj = new CHtmlPurifier();
     $obj->options = array('HTML.Allowed' => 'a[href],b,i,u,p,br,div');
     //http://htmlpurifier.org/live/configdoc/plain.html#HTML.Allowed
     return array(array('priority_id', 'numerical', 'integerOnly' => true, 'on' => 'add,update,moderate,authorize'), array('priority_id', 'numerical', 'min' => 1, 'max' => 3), array('title, content_type_id', 'required', 'on' => 'add,update'), array('content_type_id,country_id', 'numerical', 'integerOnly' => true, 'on' => 'add,update'), array('title', 'length', 'max' => 240, 'on' => 'add,update'), array('user_comment', 'type', 'type' => 'string', 'on' => 'add,update'), array('user_comment', 'filter', 'filter' => array($obj, 'purify')), array('image,image_source', 'safe', 'on' => 'add,update'), array('image_url', 'url', 'on' => 'add,update'), array('text', 'safe', 'on' => 'add,update'), array('video', 'safe', 'on' => 'add,update'), array('content_type_id', 'validateContentType', 'on' => 'add,update'), array('user_position_ymd,user_position_hour,user_position_minute', 'safe', 'on' => 'add,update'), array('user_position_anydatetime', 'validateDateTime', 'on' => 'add,update'), array('disabled,deleted', 'numerical', 'integerOnly' => true, 'on' => 'moderate,authorize'), array('tag, category', 'length', 'max' => 240), array('approved', 'numerical', 'integerOnly' => true, 'on' => 'moderate'), array('moderator_comment', 'length', 'max' => 240, 'on' => 'moderate'), array('approved', 'validateApprobation', 'on' => 'moderate'), array('authorized', 'numerical', 'integerOnly' => true, 'on' => 'authorize'), array('authorized', 'validateAuthorization', 'on' => 'authorize'), array('verifyCode', 'captcha', 'allowEmpty' => !CCaptcha::checkRequirements(), 'on' => 'add'), array('id, user_id, user_ip, user_comment, title, urn, content_type_id, approved, authorized, disabled, deleted, content_id, country_id, moderator_id, moderator_ip, moderator_comment, time_submitted, time_moderated, priority_id, show_time,position', 'safe', 'on' => 'manage'), array('username, title, deleted, urn, tag, content_type_id, country_id, time_submitted, priority_id, show_time', 'safe', 'on' => 'history'));
 }
Example #10
0
 public function rules()
 {
     $rules = array(array('username, password, verifyPassword, email', 'required'), array('username', 'length', 'max' => 20, 'min' => 3, 'message' => UserModule::t("Incorrect username (length between 3 and 20 characters).")), array('password', 'length', 'max' => 128, 'min' => 4, 'message' => UserModule::t("Incorrect password (minimal length 4 symbols).")), array('email', 'email'), array('username', 'unique', 'message' => UserModule::t("This user's name already exists.")), array('email', 'unique', 'message' => UserModule::t("This user's email address already exists.")), array('username', 'match', 'pattern' => '/^[A-Za-z0-9_]+$/u', 'message' => UserModule::t("Incorrect symbols (A-z0-9).")));
     if (!(isset($_POST['ajax']) && $_POST['ajax'] === 'registration-form')) {
         array_push($rules, array('verifyCode', 'CaptchaExtendedValidator', 'allowEmpty' => !CCaptcha::checkRequirements() || !extension_loaded('gd')));
     }
     array_push($rules, array('verifyPassword', 'compare', 'compareAttribute' => 'password', 'message' => UserModule::t("Retype Password is incorrect.")));
     return $rules;
 }
Example #11
0
 public function rules()
 {
     // add, edit - действия администратора
     // register, update - действия пользователя
     if ($this->rules) {
         return $this->rules;
     }
     return array(array('login', 'filter', 'filter' => 'strtolower'), array('login, password, password_repeat', 'filter', 'filter' => 'trim'), array('login, password', 'required', 'on' => 'add'), array('login, email, password', 'length', 'max' => 32, 'min' => 5, 'encoding' => 'UTF-8'), array('login, email', 'unique'), array('email', 'required'), array('displayname', 'required', 'on' => 'update'), array('login', 'match', 'pattern' => '/^[a-z]+[a-z0-9-]*[a-z0-9]+$/', 'message' => Yii::t('cms', '{attribute} can only contain letters and numbers. And it can not start with a digit or sign')), array('password', 'match', 'pattern' => '/^[[:graph:]]*$/', 'message' => Yii::t('cms', '{attribute} can only contain letters and numbers')), array('email', 'email'), array('password', 'compare', 'compareAttribute' => 'password_repeat'), array('password, password_repeat, authcode', 'safe'), array('login', 'unsafe', 'on' => array('edit', 'update')), array('displayname', 'length', 'max' => 64, 'encoding' => 'UTF-8'), array('active, askfill, show_email, send_message', 'unsafe', 'on' => array('register', 'view')), array('active, askfill, captcha, agreed', 'unsafe', 'on' => array('update', 'view')), array('active, askfill, agreed', 'boolean'), array('show_email, send_message', 'safe'), array('extra_fields', 'FieldsValidator', 'config' => User::extraFields()), array('captcha', 'captcha', 'on' => 'register', 'allowEmpty' => !CCaptcha::checkRequirements() || !Yii::app()->user->isGuest, 'captchaAction' => 'site/captcha'), array('password, password_repeat, captcha', 'unsafe', 'on' => 'view'), array('timezone', 'safe'), array('_roles', 'safe'));
 }
Example #12
0
 public function rules()
 {
     $rules = array(array('email, password', 'required'), array('rememberMe', 'boolean'), array('password', 'authenticate'));
     $cookieInfo = zmf::getCookie('checkWithCaptcha');
     if ($cookieInfo == '1') {
         $rules[] = array('verifyCode', 'captcha', 'allowEmpty' => !CCaptcha::checkRequirements());
     }
     return $rules;
 }
 /**
  * Declares the validation rules.
  */
 public function rules()
 {
     $rules = CMap::mergeArray(parent::rules(), array(array('textPassword, verifyPassword, verifyEmail, verifyCode', 'required'), array('textPassword', 'length', 'max' => 128, 'min' => 6, 'message' => UserModule::t("Incorrect password (minimal length 6 symbols).")), array('verifyPassword', 'compare', 'compareAttribute' => 'textPassword', 'message' => UserModule::t("Retype Password is incorrect.")), array('verifyEmail', 'compare', 'compareAttribute' => 'email', 'message' => UserModule::t("Retype Email is incorrect."))));
     if (isset($_POST['ajax']) && $_POST['ajax'] === 'registration-form') {
         return $rules;
     } else {
         array_push($rules, array('verifyCode', 'captcha', 'allowEmpty' => !CCaptcha::checkRequirements()));
     }
     return $rules;
 }
Example #14
0
	/**
	 * Declares the validation rules.
	 */
	public function rules() {
		return array(
			// name, email, subject and body are required
			array('name, email, subject, body', 'required'),
			// email has to be a valid email address
			array('email', 'email'),
			// verifyCode needs to be entered correctly
			array('verifyCode', 'captcha', 'allowEmpty'=>!CCaptcha::checkRequirements()),
		);
	}
Example #15
0
 public function rules()
 {
     $rules = array(array('code, honour', 'required'), array('code', 'checkCode'), array('honour', 'checkHonour'), array('comment', 'checkComment'), array('url', 'checkUrl'), array('content', 'checkContent'), array('uploadedfile', 'file', 'allowEmpty' => true, 'maxSize' => 1024 * Helpers::getYiiParam('uploadMaxSize'), 'tooLarge' => 'The file was too large. Please upload a smaller file. The maximum size allowed is ' . Helpers::getYiiParam('uploadMaxSize') . ' KiB.'));
     // FIXME - I should probably use a scenario for this. Must check!
     if ($this->byteacher) {
         $rules[] = array('verifyCode', 'safe');
     } else {
         $rules[] = array('verifyCode', 'captcha', 'allowEmpty' => !CCaptcha::checkRequirements(), 'captchaAction' => 'site/captcha');
     }
     return $rules;
 }
Example #16
0
 private function checkCaptcha()
 {
     if (is_object($this->captcha)) {
         $code = $this->request->getPost("captcha_code");
         $word = $this->request->getPost("captcha_word");
         if (strlen($code) > 0 && !$this->captcha->CheckCodeCrypt($word, $code, COption::GetOptionString("main", "captcha_password", "")) || strlen($code) <= 0 && !$this->captcha->CheckCode($word, 0)) {
             return false;
         }
     }
     return true;
 }
 public function rules()
 {
     $rules = array(array('gs_id,login,email,verifyCode', 'filter', 'filter' => 'trim'), array('gs_id,login,email', 'required'), array('login', 'length', 'min' => Users::LOGIN_MIN_LENGTH, 'max' => Users::LOGIN_MAX_LENGTH), array('email', 'email', 'message' => Yii::t('main', 'Введите корректный Email адрес.')), array('login', 'loginIsExists'), array('gs_id', 'gsIsExists'));
     // Captcha
     $captcha = config('forgotten_password.captcha.allow') && CCaptcha::checkRequirements();
     if ($captcha) {
         $rules[] = array('verifyCode', 'filter', 'filter' => 'trim');
         $rules[] = array('verifyCode', 'required');
         $rules[] = array('verifyCode', 'validators.CaptchaValidator');
     }
     return $rules;
 }
 /**
  * Declares the validation rules.
  * The rules state that username and password are required,
  * and password needs to be authenticated.
  */
 public function rules()
 {
     if (!isset($this->scenario)) {
         $this->scenario = 'login';
     }
     $rules = array(array('username, password', 'required', 'on' => 'login'), array('rememberMe', 'boolean'));
     if (Yum::module()->captchaAfterUnsuccessfulLogins !== false) {
         $rules[] = array('verifyCode', 'captcha', 'on' => 'captcha', 'allowEmpty' => !CCaptcha::checkRequirements());
         $rules[] = array('username, password', 'required', 'on' => 'captcha');
     }
     return $rules;
 }
Example #19
0
 public function rules()
 {
     $rules = array(array('gs_id,login,password', 'filter', 'filter' => 'trim'), array('gs_id,login,password', 'required'), array('login', 'length', 'min' => Users::LOGIN_MIN_LENGTH, 'max' => Users::LOGIN_MAX_LENGTH), array('password', 'length', 'min' => Users::PASSWORD_MIN_LENGTH, 'max' => Users::PASSWORD_MAX_LENGTH), array('login', 'loginExists'), array('gs_id', 'gsIsExists'));
     // Captcha
     $captcha = config('login.captcha.allow') && CCaptcha::checkRequirements();
     if ($captcha) {
         $rules[] = array('verifyCode', 'filter', 'filter' => 'trim');
         $rules[] = array('verifyCode', 'required');
         $rules[] = array('verifyCode', 'validators.CaptchaValidator');
     }
     return $rules;
 }
Example #20
0
	public function rules() {
		return array(    
			array('verifyCode', 'activeCaptcha', 'allowEmpty'=>!Y::isGuest() || !CCaptcha::checkRequirements()), // Во время AJAX запроса не забудьте установить сценарий для модели
		    //to captcha ajax validation    
			/*array('verifyCode','captcha',
               // авторизованным пользователям код можно не вводить
               ,
			   'captchaAction' => 'site/captcha'
            ),*/
            
		);
	}
Example #21
0
 /**
  * Declares the validation rules.
  * The rules state that username and password are required,
  * and password needs to be authenticated.
  */
 public function rules() {
     return array(
         // username and password are required
         array('username', 'required', 'message'=>'Введите Логин или E-mail'),
         array('password', 'required','message'=>'Введите пароль'),
         // rememberMe needs to be a boolean
         //array('rememberMe', 'boolean'),
         array('verifyCode', 'captcha', 'allowEmpty'=>!Yii::app()->user->isGuest || !CCaptcha::checkRequirements(), 'on' => 'admin'),
         // password needs to be authenticated
         array('password', 'authenticate'),
         
     );
 }
 public function rules()
 {
     $rules = parent::rules();
     if (!(Yum::hasModule('registration') && Yum::module('registration')->registration_by_email)) {
         $rules[] = array('username', 'required');
     }
     $rules[] = array('newsletter, terms,type_id', 'safe');
     // password requirement is already checked in YumUser model, its sufficient
     // to check for verifyPassword here
     $rules[] = array('verifyPassword', 'required');
     $rules[] = array('password', 'compare', 'compareAttribute' => 'verifyPassword', 'message' => Yum::t("Retype password is incorrect."));
     if (Yum::module('registration')->enableCaptcha && !Yum::module()->debug) {
         $rules[] = array('verifyCode', 'captcha', 'allowEmpty' => CCaptcha::checkRequirements());
     }
     return $rules;
 }
Example #23
0
	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('image', 'file', 'types'=>'jpg, jpeg, gif, png','allowEmpty'=>true),
			array('board, vid, parent_id', 'numerical', 'integerOnly'=>true),
			array('title', 'length', 'max'=>30),
			array('content','length','min'=>3,'allowEmpty'=>false),
			array('content', 'safe'),
			array('verifyCode', 'captcha', 'allowEmpty'=>!CCaptcha::checkRequirements()),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id, board, vid, parent_id, title, filename, content', 'safe', 'on'=>'search'),
		);
	}
Example #24
0
 public function actionIndex()
 {
     $this->pageTitle = Lang::t('Register');
     $user_model = new Users(Users::SCENARIO_SIGNUP);
     $user_model->activation_code = Common::generateHash(microtime());
     $user_model->user_level = UserLevels::LEVEL_MEMBER;
     $user_model->timezone = SettingsTimezone::DEFAULT_TIME_ZONE;
     $user_model_class_name = $user_model->getClassName();
     $person_model = new Person();
     $person_model_class_name = $person_model->getClassName();
     $person_address = new PersonAddress();
     $person_address_class_name = $person_address->getClassName();
     if (Yii::app()->request->isPostRequest) {
         $verifyPhoneCode = isset($_POST['verifyPhoneCode']) ? $_POST['verifyPhoneCode'] : null;
         $verifyMailCode = isset($_POST['verifyMailCode']) ? $_POST['verifyMailCode'] : null;
         if (isset($_POST[$user_model_class_name])) {
             $user_model->validatorList->add(CValidator::createValidator('CaptchaExtendedValidator', $user_model, 'verifyCode', array('allowEmpty' => !CCaptcha::checkRequirements())));
             $user_model->attributes = $_POST[$user_model_class_name];
             $user_model->status = 'Active';
             $user_model->answer = strtoupper($user_model->answer);
             $user_model->validate();
         }
         if (isset($_POST[$person_model_class_name])) {
             $person_model->attributes = $_POST[$person_model_class_name];
             $person_model->married = 'n';
             $person_model->havechildren = 'n';
             $person_model->validate();
         }
         if (isset($_POST['PersonAddress'])) {
             $person_address->attributes = $_POST[$person_address_class_name];
             $person_address->validate(array('phone1'));
         }
         if (!$user_model->hasErrors() && !$person_model->hasErrors() && !$person_address->hasErrors()) {
             if ($user_model->save(FALSE)) {
                 $person_model->id = $user_model->id;
                 $person_model->save(FALSE);
                 $person_address->person_id = $person_model->id;
                 $person_address->save(FALSE);
                 Yii::app()->user->setFlash('success', Lang::t('Account created successfullly. Please enter your login details.'));
                 $this->redirect($this->createUrl('/users/default/view', array('id' => $user_model->id)));
                 //$this->redirect('../default/login');
             }
         }
     }
     $this->render('index', array('user_model' => $user_model, 'person_model' => $person_model, 'person_address' => $person_address, 'verifyPhoneCode' => isset($verifyPhoneCode) ? $verifyPhoneCode : null, 'verifyMailCode' => isset($verifyMailCode) ? $verifyMailCode : null));
 }
 public function actionIndex()
 {
     MemberNetwork::model()->updateNetwork(11, 10);
     $this->pageTitle = Lang::t('Register');
     //member model
     $member_model = new Member();
     $member_model_class_name = $member_model->getClassName();
     //user model
     $user_model = new Users(Users::SCENARIO_SIGNUP);
     $user_model->activation_code = Common::generateHash(microtime());
     $user_model->user_level = UserLevels::LEVEL_MEMBER;
     $user_model->timezone = SettingsTimezone::DEFAULT_TIME_ZONE;
     $user_model_class_name = $user_model->getClassName();
     //person model
     $person_model = new Person();
     $person_model_class_name = $person_model->getClassName();
     if (Yii::app()->request->isPostRequest) {
         if (isset($_POST[$member_model_class_name])) {
             $member_model->attributes = $_POST[$member_model_class_name];
             $member_model->validate();
         }
         if (isset($_POST[$user_model_class_name])) {
             $user_model->validatorList->add(CValidator::createValidator('CaptchaExtendedValidator', $user_model, 'verifyCode', array('allowEmpty' => !CCaptcha::checkRequirements())));
             $user_model->attributes = $_POST[$user_model_class_name];
             $user_model->validate();
         }
         if (isset($_POST[$person_model_class_name])) {
             $person_model->attributes = $_POST[$person_model_class_name];
             $person_model->validate();
         }
         if (!$member_model->hasErrors() && !$user_model->hasErrors() && !$person_model->hasErrors()) {
             if ($user_model->save(FALSE)) {
                 $person_model->id = $user_model->id;
                 $person_model->save(FALSE);
                 $member_model->id = $user_model->id;
                 $member_model->save(FALSE);
                 Yii::app()->user->setFlash('success', Lang::t('Check your email for account activation email.'));
                 $this->refresh();
             }
         }
     }
     $this->render('index', array('member_model' => $member_model, 'user_model' => $user_model, 'person_model' => $person_model));
 }
Example #26
0
	/**
	 * Declares the validation rules.
	 * The rules state that username and password are required,
	 * and password needs to be authenticated.
	 */
	public function rules()
	{
		return array(
			// username and password are required
			array('username, password ', 'required','on'=>'login','message'=>''),
			array('parent_username, parent_password', 'required','on'=>'parentlogin','message'=>''),		
			// rememberMe needs to be a boolean
			array('rememberMe', 'boolean'),
			// password needs to be authenticated
			array('password', 'authenticate','on'=>'login'),
			array('parent_password', 'authenticate','on'=>'parentlogin'),
			
			array('username, password, verifyCode','required','on'=>'captchaRequired','message'=>''),
			array('parent_username, parent_password, verifyCode','required','on'=>'parentcaptchaRequired','message'=>''),
			
			array('verifyCode', 'CaptchaExtendedValidator', 'allowEmpty'=>CCaptcha::checkRequirements()),

		);
	}
Example #27
0
    ?>

    <?php 
    echo $form->textFieldRow($model, 'email');
    ?>

    <?php 
    echo $form->textFieldRow($model, 'subject', array('size' => 60, 'maxlength' => 128));
    ?>

    <?php 
    echo $form->textAreaRow($model, 'body', array('rows' => 6, 'class' => 'span8'));
    ?>

	<?php 
    if (CCaptcha::checkRequirements()) {
        ?>
		<?php 
        echo $form->captchaRow($model, 'verifyCode', array('hint' => 'Please enter the letters as they are shown in the image above.<br/>Letters are not case-sensitive.'));
        ?>
	<?php 
    }
    ?>

	<div class="form-actions">
		<?php 
    $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'label' => 'Submit'));
    ?>
	</div>

<?php 
Example #28
0
 public function rules()
 {
     return array(array('email', 'required'), array('verifyCode', 'captcha', 'allowEmpty' => !CCaptcha::checkRequirements(), 'captchaAction' => 'site/captcha'));
 }
Example #29
0
<div class='row'>
    <div class="col-sm-6">
        <?php 
echo $form->passwordFieldGroup($model, 'cPassword');
?>
    </div>
    <div class="col-sm-4 form-group" style="padding-top: 25px;">
        <?php 
$this->widget('bootstrap.widgets.TbButton', ['label' => Yii::t('UserModule.user', 'Generate password'), 'htmlOptions' => ['id' => 'generate_password', 'data-minlength' => $this->module->minPasswordLength]]);
?>
    </div>
</div>

<?php 
if ($module->showCaptcha && CCaptcha::checkRequirements()) {
    ?>
    <div class="row">
        <div class="col-xs-4">
            <?php 
    echo $form->textFieldGroup($model, 'verifyCode', ['hint' => Yii::t('UserModule.user', 'Please enter the text from the image')]);
    ?>
        </div>
        <div class="col-xs-4">
            <?php 
    $this->widget('CCaptcha', ['showRefreshButton' => true, 'imageOptions' => ['width' => '150'], 'buttonOptions' => ['class' => 'btn btn-default'], 'buttonLabel' => '<i class="glyphicon glyphicon-repeat"></i>']);
    ?>
        </div>
    </div>
<?php 
}
 public function rules()
 {
     return array(array('report', 'required'), array('email', 'required'), array('email', 'email'), array('name, report, email', 'safe'), array('verifyCode', 'captcha', 'allowEmpty' => !CCaptcha::checkRequirements()));
 }