Advertisement
Guest User

Untitled

a guest
Jun 28th, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. public function rules()
  2. {
  3. return[
  4. [['email', 'password'], 'required'],
  5. ['email', 'email'],
  6. ['email', 'unique', 'targetClass' => 'appModelsUser'],
  7. ['password', 'string', 'min' => 2, 'max' => 10]
  8. ];
  9. }
  10.  
  11. public function signup()
  12. {
  13. $user = new User();
  14. $user->email = $this->email;
  15. $user->password = $this->password;
  16. return $user->save();
  17. }
  18.  
  19. if (isset($_POST['Signup']))
  20. {
  21. $model->attributes = Yii::$app->request->post('Signup');
  22.  
  23. if ($model->validate() && $model->signup())
  24. {
  25. return $this->goHome();
  26. }
  27. }
  28.  
  29. return $this->render('signup',
  30. ['model'=>$model]);
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement