Fix for when user changes their own password, and thus the password in the cookie is no longer valid
This commit is contained in:
parent
9207d4e698
commit
36a985554d
@ -4,11 +4,12 @@ namespace App\Classes\LDAP;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Exception;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\Cookie;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use LdapRecord\LdapRecordException;
|
||||
use LdapRecord\Models\Model;
|
||||
use LdapRecord\Query\Collection as LDAPCollection;
|
||||
@ -164,6 +165,16 @@ final class Server
|
||||
} catch (LdapRecordException $e) {
|
||||
switch ($e->getDetailedError()->getErrorCode()) {
|
||||
case 49:
|
||||
// Since we failed authentication, we should delete our auth cookie
|
||||
if (Cookie::has('password_encrypt')) {
|
||||
Log::alert('Clearing user credentials and logging out');
|
||||
|
||||
Cookie::queue(Cookie::forget('password_encrypt'));
|
||||
Cookie::queue(Cookie::forget('username_encrypt'));
|
||||
|
||||
Session::invalidate();
|
||||
}
|
||||
|
||||
abort(401,$e->getDetailedError()->getErrorMessage());
|
||||
|
||||
default:
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
<div class="modal-body">
|
||||
<div class="text-center">
|
||||
<span class="badge badge-danger fsize-2 mb-3 ">@yield('error')</span>
|
||||
<span class="badge text-danger fsize-2 mb-3">@yield('error')</span>
|
||||
</div>
|
||||
<table class="table">
|
||||
<tr>
|
||||
|
9
resources/views/errors/401.blade.php
Normal file
9
resources/views/errors/401.blade.php
Normal file
@ -0,0 +1,9 @@
|
||||
@extends('architect::layouts.error')
|
||||
|
||||
@section('error')
|
||||
401: @lang('LDAP Authentication Error')
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
{{ $exception->getMessage() }}
|
||||
@endsection
|
@ -1,7 +1,7 @@
|
||||
@extends('architect::layouts.error')
|
||||
|
||||
@section('error')
|
||||
@lang('LDAP Server Unavailable')
|
||||
597: @lang('LDAP Server Unavailable')
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
|
Loading…
Reference in New Issue
Block a user