identification

This commit is contained in:
sidya82
2015-02-15 07:12:44 +01:00
parent ba7b40bb5f
commit af395a32ef
325 changed files with 183 additions and 185 deletions

0
SRC/.env.example Normal file → Executable file
View File

0
SRC/.gitattributes vendored Normal file → Executable file
View File

0
SRC/.gitignore vendored Normal file → Executable file
View File

0
SRC/app/Commands/Command.php Normal file → Executable file
View File

0
SRC/app/Console/Commands/Inspire.php Normal file → Executable file
View File

0
SRC/app/Console/Kernel.php Normal file → Executable file
View File

0
SRC/app/Events/Event.php Normal file → Executable file
View File

0
SRC/app/Exceptions/Handler.php Normal file → Executable file
View File

0
SRC/app/Handlers/Commands/.gitkeep Normal file → Executable file
View File

0
SRC/app/Handlers/Events/.gitkeep Normal file → Executable file
View File

2
SRC/app/Http/Controllers/AdminController.php Normal file → Executable file
View 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
View 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
View File

0
SRC/app/Http/Controllers/Controller.php Normal file → Executable file
View File

2
SRC/app/Http/Controllers/GameController.php Normal file → Executable file
View 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
View File

57
SRC/app/Http/Controllers/LoginController.php Normal file → Executable file
View 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
View File

0
SRC/app/Http/Controllers/WelcomeController.php Normal file → Executable file
View File

1
SRC/app/Http/Kernel.php Normal file → Executable file
View File

@ -27,6 +27,7 @@ class Kernel extends HttpKernel {
'auth' => 'App\Http\Middleware\Authenticate',
'auth.basic' => 'Illuminate\Auth\Middleware\AuthenticateWithBasicAuth',
'guest' => 'App\Http\Middleware\RedirectIfAuthenticated',
'admin' => 'App\Http\Middleware\RedirectIfNotAdmin',
];
}

2
SRC/app/Http/Middleware/Authenticate.php Normal file → Executable file
View File

@ -40,7 +40,7 @@ class Authenticate {
}
else
{
return redirect()->guest('auth/login');
return redirect()->guest('login');
}
}

2
SRC/app/Http/Middleware/RedirectIfAuthenticated.php Normal file → Executable file
View File

@ -35,7 +35,7 @@ class RedirectIfAuthenticated {
{
if ($this->auth->check())
{
return new RedirectResponse(url('/home'));
return new RedirectResponse(url('/referent'));
}
return $next($request);

View File

@ -0,0 +1,45 @@
<?php namespace App\Http\Middleware;
use Closure;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Http\RedirectResponse;
use Auth;
class RedirectIfNotAdmin {
/**
* The Guard implementation.
*
* @var Guard
*/
protected $auth;
/**
* Create a new filter instance.
*
* @param Guard $auth
* @return void
*/
public function __construct(Guard $auth)
{
$this->auth = $auth;
}
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (!$this->auth->check() OR Auth::user()->admin == 0)
{
return new RedirectResponse(url('/login'));
}
return $next($request);
}
}

0
SRC/app/Http/Middleware/VerifyCsrfToken.php Normal file → Executable file
View File

0
SRC/app/Http/Requests/Request.php Normal file → Executable file
View File

24
SRC/app/Http/routes.php Normal file → Executable file
View File

@ -13,13 +13,23 @@
Route::get('/', 'GameController@index');
Route::get('login', 'LoginController@index');
Route::group(['middleware' => 'guest'], function ()
{
Route::get('login', 'LoginController@index');
Route::post('login', 'LoginController@authenticate');
Route::get('oublie', 'LoginController@forgottenPassword');
Route::post('oublie', 'LoginController@initPassword');
});
Route::get('referent', 'ReferentController@index');
Route::get('admin', 'AdminController@index');
Route::group(['middleware' => 'auth'], function ()
{
Route::get('referent', 'ReferentController@index');
Route::get('logout', 'LoginController@logout');
});
Route::group(['middleware' => 'admin'], function ()
{
Route::get('admin', 'AdminController@index');
});
Route::controllers([
'auth' => 'Auth\AuthController',
'password' => 'Auth\PasswordController',
]);

0
SRC/app/Providers/AppServiceProvider.php Normal file → Executable file
View File

0
SRC/app/Providers/BusServiceProvider.php Normal file → Executable file
View File

0
SRC/app/Providers/ConfigServiceProvider.php Normal file → Executable file
View File

0
SRC/app/Providers/EventServiceProvider.php Normal file → Executable file
View File

0
SRC/app/Providers/RouteServiceProvider.php Normal file → Executable file
View File

0
SRC/app/Services/Registrar.php Normal file → Executable file
View File

0
SRC/app/User.php Normal file → Executable file
View File

0
SRC/bootstrap/app.php Normal file → Executable file
View File

0
SRC/bootstrap/autoload.php Normal file → Executable file
View File

0
SRC/composer.json Normal file → Executable file
View File

0
SRC/composer.lock generated Normal file → Executable file
View File

0
SRC/config/app.php Normal file → Executable file
View File

2
SRC/config/auth.php Normal file → Executable file
View File

@ -15,7 +15,7 @@ return [
|
*/
'driver' => 'eloquent',
'driver' => 'database',
/*
|--------------------------------------------------------------------------

0
SRC/config/cache.php Normal file → Executable file
View File

0
SRC/config/compile.php Normal file → Executable file
View File

View File

@ -1,125 +0,0 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| PDO Fetch Style
|--------------------------------------------------------------------------
|
| By default, database results will be returned as instances of the PHP
| stdClass object; however, you may desire to retrieve records in an
| array format for simplicity. Here you can tweak the fetch style.
|
*/
'fetch' => PDO::FETCH_CLASS,
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for all database work. Of course
| you may use many connections at once using the Database library.
|
*/
'default' => 'mysql',
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple.
|
|
| All database work in Laravel is done through the PHP PDO facilities
| so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development.
|
*/
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'database' => storage_path().'/database.sqlite',
'prefix' => '',
],
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
],
'pgsql' => [
'driver' => 'pgsql',
'host' => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'schema' => 'public',
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'host' => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'prefix' => '',
],
],
/*
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run in the database.
|
*/
'migrations' => 'migrations',
/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer set of commands than a typical key-value systems
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
*/
'redis' => [
'cluster' => false,
'default' => [
'host' => '127.0.0.1',
'port' => 6379,
'database' => 0,
],
],
];

0
SRC/config/filesystems.php Normal file → Executable file
View File

0
SRC/config/mail.php Normal file → Executable file
View File

0
SRC/config/queue.php~HEAD Normal file → Executable file
View File

0
SRC/config/services.php Normal file → Executable file
View File

0
SRC/config/session.php Normal file → Executable file
View File

0
SRC/config/view.php Normal file → Executable file
View File

0
SRC/database/.gitignore vendored Normal file → Executable file
View File

0
SRC/database/migrations/.gitkeep Normal file → Executable file
View File

View File

0
SRC/database/seeds/.gitkeep Normal file → Executable file
View File

22
SRC/database/seeds/DatabaseSeeder.php Normal file → Executable file
View File

@ -14,7 +14,27 @@ class DatabaseSeeder extends Seeder {
{
Model::unguard();
// $this->call('UserTableSeeder');
$this->call('UserTableSeeder');
}
}
class UserTableSeeder extends Seeder {
public function run()
{
// Uncomment the below to wipe the table clean before populating
//DB::table('users')->truncate();
$user = array(
'name' => 'lolman',
'email' => 'quentin.rouland@laposte.net',
'password' => Hash::make('admin'),
'image' => ''
);
// Uncomment the below to run the seeder
DB::table('users')->insert($user);
}
}

0
SRC/gulpfile.js Normal file → Executable file
View File

0
SRC/package.json Normal file → Executable file
View File

0
SRC/phpspec.yml Normal file → Executable file
View File

0
SRC/phpunit.xml Normal file → Executable file
View File

0
SRC/public/fonts/glyphicons-halflings-regular.eot Normal file → Executable file
View File

0
SRC/public/fonts/glyphicons-halflings-regular.svg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 106 KiB

After

Width:  |  Height:  |  Size: 106 KiB

0
SRC/public/fonts/glyphicons-halflings-regular.ttf Normal file → Executable file
View File

0
SRC/public/fonts/glyphicons-halflings-regular.woff Normal file → Executable file
View File

0
SRC/public/fonts/glyphicons-halflings-regular.woff2 Normal file → Executable file
View File

0
SRC/public/pictures/holder.jpg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

0
SRC/readme.md Normal file → Executable file
View File

0
SRC/resources/assets/less/app.less Normal file → Executable file
View File

0
SRC/resources/assets/less/bootstrap/alerts.less Normal file → Executable file
View File

0
SRC/resources/assets/less/bootstrap/badges.less Normal file → Executable file
View File

0
SRC/resources/assets/less/bootstrap/bootstrap.less vendored Normal file → Executable file
View File

0
SRC/resources/assets/less/bootstrap/breadcrumbs.less Normal file → Executable file
View File

0
SRC/resources/assets/less/bootstrap/button-groups.less Normal file → Executable file
View File

0
SRC/resources/assets/less/bootstrap/buttons.less Normal file → Executable file
View File

0
SRC/resources/assets/less/bootstrap/carousel.less Normal file → Executable file
View File

0
SRC/resources/assets/less/bootstrap/close.less Normal file → Executable file
View File

0
SRC/resources/assets/less/bootstrap/code.less Normal file → Executable file
View File

View File

0
SRC/resources/assets/less/bootstrap/dropdowns.less Normal file → Executable file
View File

0
SRC/resources/assets/less/bootstrap/forms.less Normal file → Executable file
View File

0
SRC/resources/assets/less/bootstrap/glyphicons.less Normal file → Executable file
View File

0
SRC/resources/assets/less/bootstrap/grid.less Normal file → Executable file
View File

0
SRC/resources/assets/less/bootstrap/input-groups.less Normal file → Executable file
View File

0
SRC/resources/assets/less/bootstrap/jumbotron.less Normal file → Executable file
View File

0
SRC/resources/assets/less/bootstrap/labels.less Normal file → Executable file
View File

0
SRC/resources/assets/less/bootstrap/list-group.less Normal file → Executable file
View File

0
SRC/resources/assets/less/bootstrap/media.less Normal file → Executable file
View File

0
SRC/resources/assets/less/bootstrap/mixins.less Normal file → Executable file
View File

0
SRC/resources/assets/less/bootstrap/mixins/alerts.less Normal file → Executable file
View File

View File

View File

View File

View File

View File

0
SRC/resources/assets/less/bootstrap/mixins/forms.less Normal file → Executable file
View File

View File

View File

0
SRC/resources/assets/less/bootstrap/mixins/grid.less Normal file → Executable file
View File

View File

0
SRC/resources/assets/less/bootstrap/mixins/image.less Normal file → Executable file
View File

0
SRC/resources/assets/less/bootstrap/mixins/labels.less Normal file → Executable file
View File

View File

Some files were not shown because too many files have changed in this diff Show More