frontend/models/SignupForm.php
/**
     * Signs user up.
     *
     * @return User|null the saved model or null if saving fails
     */
Signs user up.
@return User|null the saved model or null if saving fails
Signs user up . @return User|null the saved model or null if saving fails
public function signup()
    {
        if (!$this->validate()) {
            return null;
        }
        $user = new User();
        $user->email = $this->email;
        $user->expiration_date = $this->expiration_date;
        $user->access_token = $this->access_token;
        $user->setPassword($this->password);
        $user->generateAuthKey();
        if ($user->save()) {
            $authManager = Yii::$app->authManager;
            $role = $authManager->getRole($this->role);
            $authManager->assign($role, $user->id);
            return $user;
        }
        return null;
    }
public function signup ( ) { if ( ! $ this -> validate ( ) ) { return null ; } $ user = new User ( ) ; $ user -> email = $ this -> email ; $ user -> expiration_date = $ this -> expiration_date ; $ user -> access_token = $ this -> access_token ; $ user -> setPassword ( $ this -> password ) ; $ user -> generateAuthKey ( ) ; if ( $ user -> save ( ) ) { $ authManager = Yii :: $ app -> authManager ; $ role = $ authManager -> getRole ( $ this -> role ) ; $ authManager -> assign ( $ role , $ user -> id ) ; return $ user ; } return null ; }
Signs user up.
Signs user up .