modifié : SRC/app/Http/Controllers/LoginController.php
modifié : SRC/app/Http/routes.php modifié : SRC/config/auth.php modifié : SRC/resources/views/auth/reset.blade.php modifié : SRC/resources/views/emails/password.blade.php
This commit is contained in:
@ -3,8 +3,9 @@ use Auth;
|
||||
use Input;
|
||||
use Validator;
|
||||
use Password;
|
||||
use DB;
|
||||
|
||||
use View;
|
||||
use Redirect;
|
||||
use Hash;
|
||||
class LoginController extends Controller {
|
||||
|
||||
/**
|
||||
@ -68,7 +69,7 @@ class LoginController extends Controller {
|
||||
|
||||
public function initPassword()
|
||||
{
|
||||
switch ($response = Password::sendResetLink(Input::only('email')))
|
||||
switch ($response = Password:: sendResetLink(Input::only('email')))
|
||||
{
|
||||
case Password::INVALID_USER:
|
||||
return redirect('forgotten')->withErrors("Mail Invalide !")->withInput();
|
||||
@ -77,4 +78,30 @@ class LoginController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function reset($token)
|
||||
{
|
||||
return View::make('auth.reset')->with('token', $token);
|
||||
}
|
||||
|
||||
public function update($token)
|
||||
{
|
||||
$credentials = array('token' => Input::get('token'), 'password' => Input::get('password'), 'password_confirmation' => Input::get('password_confirmation'));
|
||||
$response = Password::reset($credentials, function($user, $password)
|
||||
{
|
||||
$user->password = Hash::make($password);
|
||||
$user->save();
|
||||
});
|
||||
|
||||
switch ($response)
|
||||
{
|
||||
case Password::INVALID_PASSWORD:
|
||||
return Redirect::back()->withErrors("Mot de passe non valide")->withInput();
|
||||
case Password::INVALID_TOKEN:
|
||||
return Redirect::back()->withErrors("Clé invalide")->withInput();
|
||||
case Password::INVALID_USER:
|
||||
return Redirect::back()->withErrors("Utilsateur invalide")->withInput();
|
||||
case Password::PASSWORD_RESET:
|
||||
return Redirect::to('/login');
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user