1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00
invoiceninja/app/Http/Controllers/Auth/ResetPasswordController.php

66 lines
1.7 KiB
PHP
Raw Normal View History

2017-01-30 20:40:43 +01:00
<?php
namespace App\Http\Controllers\Auth;
2015-03-16 22:45:25 +01:00
use Event;
2017-11-15 10:25:41 +01:00
use Illuminate\Http\Request;
use App\Events\UserLoggedIn;
2015-03-23 05:20:33 +01:00
use App\Http\Controllers\Controller;
2015-03-16 22:45:25 +01:00
use Illuminate\Foundation\Auth\ResetsPasswords;
2017-11-14 09:58:08 +01:00
class ResetPasswordController 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.
|
*/
2015-03-16 22:45:25 +01:00
use ResetsPasswords {
2017-11-14 09:58:08 +01:00
sendResetResponse as protected traitSendResetResponse;
}
2015-03-16 22:45:25 +01:00
/**
2017-11-14 09:58:08 +01:00
* Where to redirect users after resetting their password.
*
* @var string
*/
2015-03-30 17:20:53 +02:00
protected $redirectTo = '/dashboard';
/**
2017-11-14 09:58:08 +01:00
* Create a new controller instance.
*
2017-11-14 09:58:08 +01:00
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
2017-11-14 09:58:08 +01:00
protected function sendResetResponse($response)
{
$user = auth()->user();
if ($user->google_2fa_secret) {
auth()->logout();
session(['2fa:user:id' => $user->id]);
return redirect('/validate_two_factor/' . $user->account->account_key);
} else {
Event::fire(new UserLoggedIn());
2017-11-14 09:58:08 +01:00
return $this->traitSendResetResponse($response);
}
}
2017-11-15 08:51:49 +01:00
public function showResetForm(Request $request, $token = null)
{
return view('auth.passwords.reset')->with(
2018-01-10 14:10:49 +01:00
['token' => $token]
2017-11-15 08:51:49 +01:00
);
}
2015-03-16 22:45:25 +01:00
}