identification
This commit is contained in:
2
SRC/app/Http/Controllers/AdminController.php
Normal file → Executable file
2
SRC/app/Http/Controllers/AdminController.php
Normal file → Executable file
@ -10,7 +10,7 @@ class AdminController extends Controller {
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest');
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
|
52
SRC/app/Http/Controllers/Auth/AuthController.php
Normal file → Executable file
52
SRC/app/Http/Controllers/Auth/AuthController.php
Normal file → Executable file
@ -1,38 +1,30 @@
|
||||
<?php namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Contracts\Auth\Guard;
|
||||
use Illuminate\Contracts\Auth\Registrar;
|
||||
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Auth;
|
||||
|
||||
class AuthController extends Controller {
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Registration & Login Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller handles the registration of new users, as well as the
|
||||
| authentication of existing users. By default, this controller uses
|
||||
| a simple trait to add these behaviors. Why don't you explore it?
|
||||
|
|
||||
*/
|
||||
|
||||
use AuthenticatesAndRegistersUsers;
|
||||
|
||||
/**
|
||||
* Create a new authentication controller instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Auth\Guard $auth
|
||||
* @param \Illuminate\Contracts\Auth\Registrar $registrar
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Guard $auth, Registrar $registrar)
|
||||
{
|
||||
$this->auth = $auth;
|
||||
$this->registrar = $registrar;
|
||||
* Handle an authentication attempt.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function authenticate()
|
||||
{
|
||||
|
||||
if (Auth::attempt(['email' => $email, 'password' => $password]))
|
||||
{
|
||||
return redirect()->intended('/admin');
|
||||
}
|
||||
return redirect('/login')->withErrors(['email' => 'The credentials you entered did not match our records. Try again?',]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
$this->middleware('guest', ['except' => 'getLogout']);
|
||||
}
|
||||
public function logout()
|
||||
{
|
||||
Auth::logout();
|
||||
}
|
||||
|
||||
}
|
||||
|
0
SRC/app/Http/Controllers/Auth/PasswordController.php
Normal file → Executable file
0
SRC/app/Http/Controllers/Auth/PasswordController.php
Normal file → Executable file
0
SRC/app/Http/Controllers/Controller.php
Normal file → Executable file
0
SRC/app/Http/Controllers/Controller.php
Normal file → Executable file
2
SRC/app/Http/Controllers/GameController.php
Normal file → Executable file
2
SRC/app/Http/Controllers/GameController.php
Normal file → Executable file
@ -9,7 +9,7 @@ class GameController extends Controller {
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest');
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
|
0
SRC/app/Http/Controllers/HomeController.php
Normal file → Executable file
0
SRC/app/Http/Controllers/HomeController.php
Normal file → Executable file
57
SRC/app/Http/Controllers/LoginController.php
Normal file → Executable file
57
SRC/app/Http/Controllers/LoginController.php
Normal file → Executable file
@ -1,4 +1,9 @@
|
||||
<?php namespace App\Http\Controllers;
|
||||
use Auth;
|
||||
use Input;
|
||||
use Validator;
|
||||
use Password;
|
||||
use DB;
|
||||
|
||||
class LoginController extends Controller {
|
||||
|
||||
@ -9,7 +14,7 @@ class LoginController extends Controller {
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest');
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
@ -22,4 +27,54 @@ class LoginController extends Controller {
|
||||
return view('auth.login');
|
||||
}
|
||||
|
||||
public function authenticate()
|
||||
{
|
||||
$credentials = [
|
||||
'email'=>Input::get('email'),
|
||||
'password'=>Input::get('password')
|
||||
];
|
||||
$rules = [
|
||||
'email' => 'required',
|
||||
'password'=>'required'
|
||||
];
|
||||
$validator = Validator::make($credentials,$rules);
|
||||
if($validator->passes())
|
||||
{
|
||||
if(Auth::attempt($credentials))
|
||||
{
|
||||
if (Auth::user()->admin == 1)
|
||||
return redirect()->intended('admin');
|
||||
else
|
||||
return redirect()->intended('referent');
|
||||
}
|
||||
return redirect('login')->withErrors(['erreur' => 'Mail ou mot de passe incorrect!',]);
|
||||
}
|
||||
else
|
||||
{
|
||||
return redirect('login')->withErrors($validator)->withInput();
|
||||
}
|
||||
}
|
||||
|
||||
public function logout()
|
||||
{
|
||||
Auth::logout();
|
||||
return redirect('login');
|
||||
}
|
||||
|
||||
public function forgottenPassword()
|
||||
{
|
||||
return view('auth.password');
|
||||
}
|
||||
|
||||
public function initPassword()
|
||||
{
|
||||
switch ($response = Password::remind(Input::only('email')))
|
||||
{
|
||||
case Password::INVALID_USER:
|
||||
return redirect('oublie')->withErrors($response)->withInput();
|
||||
case Password::REMINDER_SENT:
|
||||
return redirect('oublie')->withStatus($response)->withInput();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
0
SRC/app/Http/Controllers/ReferentController.php
Normal file → Executable file
0
SRC/app/Http/Controllers/ReferentController.php
Normal file → Executable file
0
SRC/app/Http/Controllers/WelcomeController.php
Normal file → Executable file
0
SRC/app/Http/Controllers/WelcomeController.php
Normal file → Executable file
Reference in New Issue
Block a user