Merge branch 'master' of https://github.com/matthieupenchenat81/ModuleWeb
Conflicts: SRC/app/Http/routes.php modified: SRC/app/Http/Controllers/LoginController.php deleted: SRC/app/Http/routes.php modified: SRC/config/auth.php modified: SRC/resources/views/auth/reset.blade.php modified: 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 { | ||||
|  | ||||
| 	/** | ||||
| @@ -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'); | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -1,50 +0,0 @@ | ||||
| <?php | ||||
|  | ||||
| /* | ||||
| |-------------------------------------------------------------------------- | ||||
| | Application Routes | ||||
| |-------------------------------------------------------------------------- | ||||
| | | ||||
| | Here is where you can register all of the routes for an application. | ||||
| | It's a breeze. Simply tell Laravel the URIs it should respond to | ||||
| | and give it the controller to call when that URI is requested. | ||||
| | | ||||
| */ | ||||
|  | ||||
| Route::get('/', 'GameController@index'); | ||||
| Route::get('referents/{id}/games', 'GameController@showReferentGames')->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'); | ||||
| }); | ||||
| @@ -61,7 +61,7 @@ return [ | ||||
| 	'password' => [ | ||||
| 		'email' => 'emails.password', | ||||
| 		'table' => 'password_resets', | ||||
| 		'expire' => 60, | ||||
| 		'expire' => 1440, | ||||
| 	], | ||||
|  | ||||
| ]; | ||||
|   | ||||
| @@ -1,15 +1,15 @@ | ||||
| @extends('app') | ||||
|  | ||||
| @section('content') | ||||
| <div class="container-fluid"> | ||||
| <div style="margin-top: 70px"  class="container-fluid"> | ||||
| 	<div class="row"> | ||||
| 		<div class="col-md-8 col-md-offset-2"> | ||||
| 			<div class="panel panel-default"> | ||||
| 				<div class="panel-heading">Reset Password</div> | ||||
| 				<div class="panel-heading">Réinitialiser Mot de Passe</div> | ||||
| 				<div class="panel-body"> | ||||
| 					@if (count($errors) > 0) | ||||
| 						<div class="alert alert-danger"> | ||||
| 							<strong>Whoops!</strong> There were some problems with your input.<br><br> | ||||
| 							<strong>Oouups!</strong> Il y a un problème.<br><br> | ||||
| 							<ul> | ||||
| 								@foreach ($errors->all() as $error) | ||||
| 									<li>{{ $error }}</li> | ||||
| @@ -18,26 +18,20 @@ | ||||
| 						</div> | ||||
| 					@endif | ||||
|  | ||||
| 					<form class="form-horizontal" role="form" method="POST" action="/password/reset"> | ||||
| 					<form class="form-horizontal" role="form" method="POST" action="/password/reset/{{ $token }}"> | ||||
| 						<input type="hidden" name="_token" value="{{ csrf_token() }}"> | ||||
| 						<input type="hidden" name="token" value="{{ $token }}"> | ||||
|  | ||||
| 						<div class="form-group"> | ||||
| 							<label class="col-md-4 control-label">E-Mail Address</label> | ||||
| 							<div class="col-md-6"> | ||||
| 								<input type="email" class="form-control" name="email" value="{{ old('email') }}"> | ||||
| 							</div> | ||||
| 						</div> | ||||
|  | ||||
| 						<div class="form-group"> | ||||
| 							<label class="col-md-4 control-label">Password</label> | ||||
| 							<label class="col-md-4 control-label">Mot de passe</label> | ||||
| 							<div class="col-md-6"> | ||||
| 								<input type="password" class="form-control" name="password"> | ||||
| 							</div> | ||||
| 						</div> | ||||
|  | ||||
| 						<div class="form-group"> | ||||
| 							<label class="col-md-4 control-label">Confirm Password</label> | ||||
| 							<label class="col-md-4 control-label">Confirmer mot de passe</label> | ||||
| 							<div class="col-md-6"> | ||||
| 								<input type="password" class="form-control" name="password_confirmation"> | ||||
| 							</div> | ||||
| @@ -46,7 +40,7 @@ | ||||
| 						<div class="form-group"> | ||||
| 							<div class="col-md-6 col-md-offset-4"> | ||||
| 								<button type="submit" class="btn btn-primary"> | ||||
| 									Reset Password | ||||
| 									Réinitialiser Password | ||||
| 								</button> | ||||
| 							</div> | ||||
| 						</div> | ||||
|   | ||||
| @@ -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) }} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user