protected function handlePOST()
    {
        $oldPassword = $this->getPayloadData('old_password');
        $newPassword = $this->getPayloadData('new_password');
        $login = $this->request->getParameterAsBool('login');

        if (!empty($oldPassword) && Session::isAuthenticated()) {
            $user = Session::user();

            return static::changePassword($user, $oldPassword, $newPassword, $login);
        }

        $email = $this->getPayloadData('email');
        $username = $this->getPayloadData('username');
        $code = $this->getPayloadData('code');
        $answer = $this->getPayloadData('security_answer');
        $loginAttribute = strtolower(config('df.login_attribute', 'email'));

        if ($this->request->getParameterAsBool('reset')) {
            if ($loginAttribute === 'username') {
                return $this->passwordResetWithUsername($username);
            }

            return $this->passwordReset($email);
        }

        if (!empty($code)) {
            if ($loginAttribute === 'username') {
                return static::changePasswordByCodeWithUsername($username, $code, $newPassword, $login);
            }

            return static::changePasswordByCode($email, $code, $newPassword, $login);
        }

        if (!empty($answer)) {
            if ($loginAttribute === 'username') {
                return static::changePasswordBySecurityAnswerWithUsername($username, $answer, $newPassword, $login);
            }

            return static::changePasswordBySecurityAnswer($email, $answer, $newPassword, $login);
        }

        throw new BadRequestException('Not enough information provided to change password.');
    }
protected function handlePOST()
    {
        $oldPassword = $this->getPayloadData('old_password');
        $newPassword = $this->getPayloadData('new_password');
        $login = $this->request->getParameterAsBool('login');

        if (!empty($oldPassword) && Session::isAuthenticated()) {
            $user = Session::user();

            return static::changePassword($user, $oldPassword, $newPassword, $login);
        }

        $email = $this->getPayloadData('email');
        $username = $this->getPayloadData('username');
        $code = $this->getPayloadData('code');
        $answer = $this->getPayloadData('security_answer');
        $loginAttribute = strtolower(config('df.login_attribute', 'email'));

        if ($this->request->getParameterAsBool('reset')) {
            if ($loginAttribute === 'username') {
                return $this->passwordResetWithUsername($username);
            }

            return $this->passwordReset($email);
        }

        if (!empty($code)) {
            if ($loginAttribute === 'username') {
                return static::changePasswordByCodeWithUsername($username, $code, $newPassword, $login);
            }

            return static::changePasswordByCode($email, $code, $newPassword, $login);
        }

        if (!empty($answer)) {
            if ($loginAttribute === 'username') {
                return static::changePasswordBySecurityAnswerWithUsername($username, $answer, $newPassword, $login);
            }

            return static::changePasswordBySecurityAnswer($email, $answer, $newPassword, $login);
        }

        throw new BadRequestException('Not enough information provided to change password.');
    }
protected function handlePOST ( ) { $ oldPassword = $ this -> getPayloadData ( 'old_password' ) ; $ newPassword = $ this -> getPayloadData ( 'new_password' ) ; $ login = $ this -> request -> getParameterAsBool ( 'login' ) ; if ( ! empty ( $ oldPassword ) && Session :: isAuthenticated ( ) ) { $ user = Session :: user ( ) ; return static :: changePassword ( $ user , $ oldPassword , $ newPassword , $ login ) ; } $ email = $ this -> getPayloadData ( 'email' ) ; $ username = $ this -> getPayloadData ( 'username' ) ; $ code = $ this -> getPayloadData ( 'code' ) ; $ answer = $ this -> getPayloadData ( 'security_answer' ) ; $ loginAttribute = strtolower ( config ( 'df.login_attribute' , 'email' ) ) ; if ( $ this -> request -> getParameterAsBool ( 'reset' ) ) { if ( $ loginAttribute === 'username' ) { return $ this -> passwordResetWithUsername ( $ username ) ; } return $ this -> passwordReset ( $ email ) ; } if ( ! empty ( $ code ) ) { if ( $ loginAttribute === 'username' ) { return static :: changePasswordByCodeWithUsername ( $ username , $ code , $ newPassword , $ login ) ; } return static :: changePasswordByCode ( $ email , $ code , $ newPassword , $ login ) ; } if ( ! empty ( $ answer ) ) { if ( $ loginAttribute === 'username' ) { return static :: changePasswordBySecurityAnswerWithUsername ( $ username , $ answer , $ newPassword , $ login ) ; } return static :: changePasswordBySecurityAnswer ( $ email , $ answer , $ newPassword , $ login ) ; } throw new BadRequestException ( 'Not enough information provided to change password.' ) ; }
Resets user password.

@return array|bool
@throws BadRequestException
@throws \Exception
Resets user password .