HCE Project DC service web UI  0.2
Hierarchical Cluster Engine DC service web UI
 All Classes Namespaces Files Functions Variables Pages
RegistrationForm.php
Go to the documentation of this file.
1 <?php
7 class RegistrationForm extends User
8 {
10  public $verifyCode;
11 
12  public function rules()
13  {
14  $rules = array(
15  array('username, password, verifyPassword, email', 'required'),
16  array('username', 'length', 'max' => 20, 'min' => 3,'message' => UserModule::t("Incorrect username (length between 3 and 20 characters).")),
17  array('password', 'length', 'max' => 128, 'min' => 4,'message' => UserModule::t("Incorrect password (minimal length 4 symbols).")),
18  array('email', 'email'),
19  array('username', 'unique', 'message' => UserModule::t("This user's name already exists.")),
20  array('email', 'unique', 'message' => UserModule::t("This user's email address already exists.")),
21  //array('verifyPassword', 'compare', 'compareAttribute'=>'password', 'message' => UserModule::t("Retype Password is incorrect.")),
22  array('username', 'match', 'pattern' => '/^[A-Za-z0-9_]+$/u','message' => UserModule::t("Incorrect symbols (A-z0-9).")),
23  );
24  if (!(isset($_POST['ajax']) && $_POST['ajax'] === 'registration-form')) {
25  array_push($rules, array('verifyCode', 'captcha', 'allowEmpty' => !UserModule::doCaptcha('registration')));
26  }
27 
28  array_push($rules, array('verifyPassword', 'compare', 'compareAttribute' => 'password', 'message' => UserModule::t("Retype Password is incorrect.")));
29 
30  return $rules;
31  }
32 
33  public function setDefaultUserAssignments($userId)
34  {
35  return
37  AccountUsers::model()->setUserDefaultAccountType($userId);
38  }
39 
40  public function setDefaultTempUserAssignments($userId)
41  {
42  return
44  AccountUsers::model()->setUserDefaultAccountType($userId, AccountUsers::DEFAULT_TEMP_ACCOUNT_TYPE);
45  }
46 }