Honor active status for forgotten password request forms

This commit is contained in:
snipe 2018-08-14 20:05:57 -07:00
parent 1543cdbc61
commit aed769c0be

View file

@ -4,6 +4,9 @@ namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ResetsPasswords;
use App\Models\User;
use Illuminate\Http\Request;
class ResetPasswordController extends Controller
{
@ -36,4 +39,18 @@ class ResetPasswordController extends Controller
{
$this->middleware('guest');
}
public function showSnipeResetForm(Request $request, $token = null)
{
// Check that the user is active
if ($user = User::where('email', '=',$request->input('email'))->where('activated','=','1')->count() > 0) {
return view('auth.passwords.reset')->with(
['token' => $token, 'email' => $request->email]
);
}
return redirect()->route('password.request')->withErrors(['email' => 'No matching users']);
}
}