mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-27 06:29:47 -08:00
ea91d59ffc
* Switch to use username instead of email * Fixed indenting * Updated password language * Updated blades to reflect username instead of email * Changed password/reset controllers to use username instead of email * Redirect to login page instead of repeating the password reset form
75 lines
1.8 KiB
PHP
75 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Auth;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use Illuminate\Foundation\Auth\ResetsPasswords;
|
|
use Illuminate\Http\Request;
|
|
|
|
|
|
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.
|
|
|
|
|
*/
|
|
|
|
use ResetsPasswords;
|
|
|
|
/**
|
|
* Where to redirect users after resetting their password.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $redirectTo = '/';
|
|
|
|
/**
|
|
* Create a new controller instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct()
|
|
{
|
|
$this->middleware('guest');
|
|
}
|
|
|
|
protected function rules()
|
|
{
|
|
return [
|
|
'token' => 'required',
|
|
'username' => 'required',
|
|
'password' => 'required|confirmed|min:6',
|
|
];
|
|
}
|
|
|
|
|
|
protected function credentials(Request $request)
|
|
{
|
|
return $request->only(
|
|
'username', 'password', 'password_confirmation', 'token'
|
|
);
|
|
}
|
|
|
|
|
|
public function showResetForm(Request $request, $token = null)
|
|
{
|
|
return view('auth.passwords.reset')->with(
|
|
['token' => $token, 'username' => $request->input('username')]
|
|
);
|
|
}
|
|
|
|
protected function sendResetFailedResponse(Request $request, $response)
|
|
{
|
|
return redirect()->back()
|
|
->withInput(['username'=>$request->input('username')])
|
|
->withErrors(['username' => trans($response)]);
|
|
}
|
|
|
|
}
|