Fixed login and added suspended message
This commit is contained in:
@@ -26,16 +26,20 @@ class LoginController extends Controller
|
|||||||
return $this->view('auth/login');
|
return $this->view('auth/login');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Request $request
|
||||||
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\View\View
|
||||||
|
*/
|
||||||
protected function sendLoginResponse(Request $request)
|
protected function sendLoginResponse(Request $request)
|
||||||
{
|
{
|
||||||
$request->session()->regenerate();
|
|
||||||
$this->clearLoginAttempts($request);
|
|
||||||
|
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
|
|
||||||
// TODO: How to handle ON_LEAVE?
|
// TODO: How to handle ON_LEAVE?
|
||||||
if($user->state !== PilotState::ACTIVE) {
|
if($user->state !== PilotState::ACTIVE) {
|
||||||
|
|
||||||
|
Log::info('Trying to login '. $user->pilot_id .', state '
|
||||||
|
. PilotState::label($user->state));
|
||||||
|
|
||||||
// Log them out
|
// Log them out
|
||||||
$this->guard()->logout();
|
$this->guard()->logout();
|
||||||
$request->session()->invalidate();
|
$request->session()->invalidate();
|
||||||
@@ -43,14 +47,16 @@ class LoginController extends Controller
|
|||||||
// Redirect to one of the error pages
|
// Redirect to one of the error pages
|
||||||
if($user->state === PilotState::PENDING) {
|
if($user->state === PilotState::PENDING) {
|
||||||
return $this->view('auth.pending');
|
return $this->view('auth.pending');
|
||||||
}
|
} elseif ($user->state === PilotState::REJECTED) {
|
||||||
|
|
||||||
elseif ($user->state === PilotState::REJECTED) {
|
|
||||||
return $this->view('auth.rejected');
|
return $this->view('auth.rejected');
|
||||||
|
} elseif ($user->state === PilotState::SUSPENDED) {
|
||||||
|
return $this->view('auth.suspended');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->authenticated($request, $this->guard()->user())
|
$request->session()->regenerate();
|
||||||
?: redirect()->intended($this->redirectPath());
|
$this->clearLoginAttempts($request);
|
||||||
|
|
||||||
|
return redirect()->intended($this->redirectPath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,8 @@ class User extends Authenticatable
|
|||||||
'flights' => 'integer',
|
'flights' => 'integer',
|
||||||
'flight_time' => 'integer',
|
'flight_time' => 'integer',
|
||||||
'balance' => 'double',
|
'balance' => 'double',
|
||||||
|
'state' => 'integer',
|
||||||
|
'status' => 'integer',
|
||||||
];
|
];
|
||||||
|
|
||||||
public static $rules = [
|
public static $rules = [
|
||||||
|
|||||||
@@ -59,6 +59,7 @@
|
|||||||
@endif
|
@endif
|
||||||
|
|
||||||
@include('layouts.default.auth.toc')
|
@include('layouts.default.auth.toc')
|
||||||
|
|
||||||
<div style="width: 100%; text-align: right; padding-top: 20px;">
|
<div style="width: 100%; text-align: right; padding-top: 20px;">
|
||||||
By registering, you agree to the Term and Conditions<br /><br />
|
By registering, you agree to the Term and Conditions<br /><br />
|
||||||
{!! Form::submit('Register!', ['class' => 'btn btn-primary']) !!}
|
{!! 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()
|
||||||
Reference in New Issue
Block a user