Browse Source

Fixed apps rules

tags/2.0.0-beta
slavcodev 11 years ago
parent
commit
f57b3536a2
  1. 4
      apps/advanced/common/models/LoginForm.php
  2. 24
      apps/advanced/common/models/User.php
  3. 4
      apps/advanced/frontend/models/ContactForm.php
  4. 4
      apps/basic/models/ContactForm.php
  5. 4
      apps/basic/models/LoginForm.php

4
apps/advanced/common/models/LoginForm.php

@ -23,9 +23,9 @@ class LoginForm extends Model
// username and password are both required // username and password are both required
[['username', 'password'], 'required'], [['username', 'password'], 'required'],
// password is validated by validatePassword() // password is validated by validatePassword()
[['password'], 'validatePassword'], ['password', 'validatePassword'],
// rememberMe must be a boolean value // rememberMe must be a boolean value
[['rememberMe'], 'boolean'], ['rememberMe', 'boolean'],
]; ];
} }

24
apps/advanced/common/models/User.php

@ -104,18 +104,18 @@ class User extends ActiveRecord implements IdentityInterface
public function rules() public function rules()
{ {
return [ return [
[['username'], 'filter', 'filter' => 'trim'], ['username', 'filter', 'filter' => 'trim'],
[['username'], 'required'], ['username', 'required'],
[['username'], 'string', 'min' => 2, 'max' => 255], ['username', 'string', 'min' => 2, 'max' => 255],
[['email'], 'filter', 'filter' => 'trim'], ['email', 'filter', 'filter' => 'trim'],
[['email'], 'required'], ['email', 'required'],
[['email'], 'email'], ['email', 'email'],
[['email'], 'unique', 'message' => 'This email address has already been taken.', 'on' => 'signup'], ['email', 'unique', 'message' => 'This email address has already been taken.', 'on' => 'signup'],
[['email'], 'exist', 'message' => 'There is no user with such email.', 'on' => 'requestPasswordResetToken'], ['email', 'exist', 'message' => 'There is no user with such email.', 'on' => 'requestPasswordResetToken'],
[['password'], 'required'], ['password', 'required'],
[['password'], 'string', 'min' => 6], ['password', 'string', 'min' => 6],
]; ];
} }

4
apps/advanced/frontend/models/ContactForm.php

@ -25,9 +25,9 @@ class ContactForm extends Model
// name, email, subject and body are required // name, email, subject and body are required
[['name', 'email', 'subject', 'body'], 'required'], [['name', 'email', 'subject', 'body'], 'required'],
// email has to be a valid email address // email has to be a valid email address
[['email'], 'email'], ['email', 'email'],
// verifyCode needs to be entered correctly // verifyCode needs to be entered correctly
[['verifyCode'], 'captcha'], ['verifyCode', 'captcha'],
]; ];
} }

4
apps/basic/models/ContactForm.php

@ -25,9 +25,9 @@ class ContactForm extends Model
// name, email, subject and body are required // name, email, subject and body are required
[['name', 'email', 'subject', 'body'], 'required'], [['name', 'email', 'subject', 'body'], 'required'],
// email has to be a valid email address // email has to be a valid email address
[['email'], 'email'], ['email', 'email'],
// verifyCode needs to be entered correctly // verifyCode needs to be entered correctly
[['verifyCode'], 'captcha'], ['verifyCode', 'captcha'],
]; ];
} }

4
apps/basic/models/LoginForm.php

@ -23,9 +23,9 @@ class LoginForm extends Model
// username and password are both required // username and password are both required
[['username', 'password'], 'required'], [['username', 'password'], 'required'],
// password is validated by validatePassword() // password is validated by validatePassword()
[['password'], 'validatePassword'], ['password', 'validatePassword'],
// rememberMe must be a boolean value // rememberMe must be a boolean value
[['rememberMe'], 'boolean'], ['rememberMe', 'boolean'],
]; ];
} }

Loading…
Cancel
Save