diff --git a/SRC/app/Http/Controllers/LoginController.php b/SRC/app/Http/Controllers/LoginController.php index c4e8321..ce17f80 100755 --- a/SRC/app/Http/Controllers/LoginController.php +++ b/SRC/app/Http/Controllers/LoginController.php @@ -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'); + } + } diff --git a/SRC/app/Http/routes.php b/SRC/app/Http/routes.php deleted file mode 100755 index 2e3179e..0000000 --- a/SRC/app/Http/routes.php +++ /dev/null @@ -1,50 +0,0 @@ -where('id', '^((?!login|referent|admin).)*$'); -Route::get('referents/{id}/games/{idGame}', 'GameController@showOneReferentGame'); -Route::get('password/reset', array( - 'uses' => 'LoginController@reset', - 'as' => 'password.reset' -)); - -Route::post('password/reset', array( - 'uses' => 'LoginController@update', - 'as' => 'password.update' -)); - - -Route::group(['middleware' => 'guest'], function () -{ - Route::get('login', 'LoginController@index'); - Route::post('login', 'LoginController@authenticate'); - Route::get('forgotten', 'LoginController@forgottenPassword'); - Route::post('forgotten', 'LoginController@initPassword'); -}); - -Route::group(['middleware' => 'auth'], function () -{ - Route::get('referent', 'ReferentController@index'); - Route::get('logout', 'LoginController@logout'); - Route::post('update', 'ReferentController@update'); -}); - -Route::group(['middleware' => 'admin'], function () -{ - Route::get('admin', 'AdminController@index'); - Route::post('addUser', 'AdminController@addUser'); - Route::post('deleteUser', 'AdminController@deleteUser'); - Route::post('updateUser', 'AdminController@updateUser'); - Route::post('logAs', 'AdminController@logAs'); -}); \ No newline at end of file diff --git a/SRC/config/auth.php b/SRC/config/auth.php index 5b436aa..7f52c0d 100755 --- a/SRC/config/auth.php +++ b/SRC/config/auth.php @@ -61,7 +61,7 @@ return [ 'password' => [ 'email' => 'emails.password', 'table' => 'password_resets', - 'expire' => 60, + 'expire' => 1440, ], ]; diff --git a/SRC/resources/views/auth/reset.blade.php b/SRC/resources/views/auth/reset.blade.php index 3ebd8de..4a15549 100755 --- a/SRC/resources/views/auth/reset.blade.php +++ b/SRC/resources/views/auth/reset.blade.php @@ -1,15 +1,15 @@ @extends('app') @section('content') -
+
-
Reset Password
+
Réinitialiser Mot de Passe
@if (count($errors) > 0)
- Whoops! There were some problems with your input.

+ Oouups! Il y a un problème.

    @foreach ($errors->all() as $error)
  • {{ $error }}
  • @@ -18,26 +18,20 @@
@endif -
+ -
- -
- -
-
- +
- +
@@ -46,7 +40,7 @@
diff --git a/SRC/resources/views/emails/password.blade.php b/SRC/resources/views/emails/password.blade.php index 2030539..656be7f 100755 --- a/SRC/resources/views/emails/password.blade.php +++ b/SRC/resources/views/emails/password.blade.php @@ -1 +1 @@ -Click here to reset your password: {{ url('password/reset/'.$token) }} +Cliquer ici pour réinitialiser votre mot de passe : {{ url('password/reset/'.$token) }}