app/Api/V1/Controllers/ResetPasswordController.php
/**
     * reset the account when form is submitted
     *
     * @param ResetPasswordRequest $request
     * @param JWTAuth $JWTAuth
     *
     * @return json response with JWToken
     */
reset the account when form is submitted
@param ResetPasswordRequest $request
@param JWTAuth $JWTAuth

@return json response with JWToken
reset the account when form is submitted @param ResetPasswordRequest $request @param JWTAuth $JWTAuth @return json response with JWToken
public function doResetPassword(ResetPasswordRequest $request, JWTAuth $JWTAuth)
    {
        $passwordReset = PasswordReset::query()->where($request->only('email', 'token'))->first();
        if ($passwordReset &&
            ($user = User::query()->where('email', $passwordReset->email)->first())
        ) {
            $user->password = $request->password;
            $user->save();
            $passwordReset->delete();
            JwtToken::blackListToken($user);
            return $this->withJson([
                'status' => 'password reset successfully'
            ]);
        }
        return $this->withMessage('Invalid request', 500);
    }
public function doResetPassword ( ResetPasswordRequest $ request , JWTAuth $ JWTAuth ) { $ passwordReset = PasswordReset :: query ( ) -> where ( $ request -> only ( 'email' , 'token' ) ) -> first ( ) ; if ( $ passwordReset && ( $ user = User :: query ( ) -> where ( 'email' , $ passwordReset -> email ) -> first ( ) ) ) { $ user -> password = $ request -> password ; $ user -> save ( ) ; $ passwordReset -> delete ( ) ; JwtToken :: blackListToken ( $ user ) ; return $ this -> withJson ( [ 'status' => 'password reset successfully' ] ) ; } return $ this -> withMessage ( 'Invalid request' , 500 ) ; }
reset the account when form is submitted
 @param ResetPasswordRequest $request
 @param JWTAuth $JWTAuth
reset the account when form is submitted @param ResetPasswordRequest $request @param JWTAuth $JWTAuth
//delete old token if exists in jwt_token table //invalid request