Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function rules()
- {
- return[
- [['email', 'password'], 'required'],
- ['email', 'email'],
- ['email', 'unique', 'targetClass' => 'appModelsUser'],
- ['password', 'string', 'min' => 2, 'max' => 10]
- ];
- }
- public function signup()
- {
- $user = new User();
- $user->email = $this->email;
- $user->password = $this->password;
- return $user->save();
- }
- if (isset($_POST['Signup']))
- {
- $model->attributes = Yii::$app->request->post('Signup');
- if ($model->validate() && $model->signup())
- {
- return $this->goHome();
- }
- }
- return $this->render('signup',
- ['model'=>$model]);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement