Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class PasswordController extends Controller
- {
- /*
- |--------------------------------------------------------------------------
- | Password Reset Controller
- |--------------------------------------------------------------------------
- |
- | This controller is responsible for handling password reset requests
- | and uses a simple trait to include this behavior. You're free to
- | explore this trait and override any methods you wish to tweak.
- |
- */
- public $redirectPath = '/';
- use ResetsPasswords, CanResetPassword;
- /**
- * Create a new password controller instance.
- *
- * @return void
- */
- public function __construct()
- {
- $this->middleware('guest');
- }
- public function sendResetLink(array $credentials)
- {
- $user = Password::getUser($credentials);
- if (is_null($user)) {
- return Password::INVALID_USER;
- }
- $token = Password::getRepository()->create($user);
- $lembrio = new LembrioClient();
- $lembrio->recuperarSenha($user, $token);
- return Password::RESET_LINK_SENT;
- }
- public function sendResetLinkEmail(Request $request)
- {
- $this->validate($request, ['email' => 'required|email']);
- $response = $this->sendResetLink($request->only('email'));
- switch ($response) {
- case Password::RESET_LINK_SENT:
- return $this->getSendResetLinkEmailSuccessResponse($response);
- case Password::INVALID_USER:
- default:
- return $this->getSendResetLinkEmailFailureResponse($response);
- }
- }
- protected function resetPassword($user, $password)
- {
- $user->password = bcrypt($password);
- $user->save();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement