Fixed login and added suspended message
This commit is contained in:
parent
014aea6ae1
commit
07bcc5f199
@ -26,16 +26,20 @@ class LoginController extends Controller
|
||||
return $this->view('auth/login');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\View\View
|
||||
*/
|
||||
protected function sendLoginResponse(Request $request)
|
||||
{
|
||||
$request->session()->regenerate();
|
||||
$this->clearLoginAttempts($request);
|
||||
|
||||
$user = Auth::user();
|
||||
|
||||
// TODO: How to handle ON_LEAVE?
|
||||
if($user->state !== PilotState::ACTIVE) {
|
||||
|
||||
Log::info('Trying to login '. $user->pilot_id .', state '
|
||||
. PilotState::label($user->state));
|
||||
|
||||
// Log them out
|
||||
$this->guard()->logout();
|
||||
$request->session()->invalidate();
|
||||
@ -43,14 +47,16 @@ class LoginController extends Controller
|
||||
// Redirect to one of the error pages
|
||||
if($user->state === PilotState::PENDING) {
|
||||
return $this->view('auth.pending');
|
||||
}
|
||||
|
||||
elseif ($user->state === PilotState::REJECTED) {
|
||||
} elseif ($user->state === PilotState::REJECTED) {
|
||||
return $this->view('auth.rejected');
|
||||
} elseif ($user->state === PilotState::SUSPENDED) {
|
||||
return $this->view('auth.suspended');
|
||||
}
|
||||
}
|
||||
|
||||
return $this->authenticated($request, $this->guard()->user())
|
||||
?: redirect()->intended($this->redirectPath());
|
||||
$request->session()->regenerate();
|
||||
$this->clearLoginAttempts($request);
|
||||
|
||||
return redirect()->intended($this->redirectPath());
|
||||
}
|
||||
}
|
||||
|
@ -55,6 +55,8 @@ class User extends Authenticatable
|
||||
'flights' => 'integer',
|
||||
'flight_time' => 'integer',
|
||||
'balance' => 'double',
|
||||
'state' => 'integer',
|
||||
'status' => 'integer',
|
||||
];
|
||||
|
||||
public static $rules = [
|
||||
|
@ -59,6 +59,7 @@
|
||||
@endif
|
||||
|
||||
@include('layouts.default.auth.toc')
|
||||
|
||||
<div style="width: 100%; text-align: right; padding-top: 20px;">
|
||||
By registering, you agree to the Term and Conditions<br /><br />
|
||||
{!! Form::submit('Register!', ['class' => 'btn btn-primary']) !!}
|
||||
|
16
resources/views/layouts/default/auth/suspended.blade.php
Normal file
16
resources/views/layouts/default/auth/suspended.blade.php
Normal file
@ -0,0 +1,16 @@
|
||||
@extends('layouts.default.app')
|
||||
|
||||
@section('title', 'account suspended')
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<div class="col-md-12 " style="text-align: center;">
|
||||
<div class="flex-center position-ref full-height">
|
||||
<div class="title m-b-md">
|
||||
<h2 class="description">
|
||||
your has been suspended. please contact an administrator
|
||||
</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection()
|
Loading…
Reference in New Issue
Block a user