From db61e0d1cea024c4bd1c07aa16725802ea91725a Mon Sep 17 00:00:00 2001 From: Deon George Date: Tue, 15 Sep 2020 22:40:32 +1000 Subject: [PATCH] Login validation, user profile icon --- README.md | 1 + app/Http/Controllers/HomeController.php | 28 ++++++ resources/images/user-secret-solid.svg | 1 + .../architect/views/auth/login.blade.php | 91 ++++++++++++------- .../architect/views/layouts/auth.blade.php | 2 + .../views/layouts/partials/scripts.blade.php | 3 - .../views/layouts/partials/topmenu.blade.php | 47 +++++----- routes/api.php | 8 +- routes/web.php | 4 + 9 files changed, 119 insertions(+), 66 deletions(-) create mode 100644 resources/images/user-secret-solid.svg diff --git a/README.md b/README.md index 98450c0..f1bb47a 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ Some of the creations planned to be used in v2 include: * JQuery (https://jquery.com) * FancyTree (https://github.com/mar10/fancytree) * ArchitectUI (https://architectui.com) +* Fontawesome Icons (https://fontawesome.com) PLA v1.2.x will be archived into [BRANCH-1.2](https://github.com/leenooks/phpLDAPadmin/tree/BRANCH-1.2), and `master` will be changed to reflect the new v2 work and effort. diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 740cd2f..44132f2 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -3,9 +3,12 @@ namespace App\Http\Controllers; use Illuminate\Http\Request; +use Illuminate\Support\Arr; +use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Crypt; use App\Classes\LDAP\Server; +use Illuminate\Support\Facades\File; class HomeController extends Controller { @@ -32,4 +35,29 @@ class HomeController extends Controller ->with('dn',$dn) ->with('leaf',(new Server())->fetch($dn)); } + + /** + * Return the image for the logged in user or anonymous + * + * @param Request $request + * @return mixed + */ + public function user_image(Request $request) + { + $image = NULL; + $content = NULL; + + if (Auth::check()) { + $image = Arr::get(Auth::user()->getAttribute('jpegphoto'),0); + $content = 'image/jpeg'; + } + + if (! $image) { + $image = File::get('../resources/images/user-secret-solid.svg'); + $content = 'image/svg+xml'; + } + + return response($image) + ->header('Content-Type',$content); + } } diff --git a/resources/images/user-secret-solid.svg b/resources/images/user-secret-solid.svg new file mode 100644 index 0000000..905d0fe --- /dev/null +++ b/resources/images/user-secret-solid.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/themes/architect/views/auth/login.blade.php b/resources/themes/architect/views/auth/login.blade.php index 9159526..ce60f6e 100644 --- a/resources/themes/architect/views/auth/login.blade.php +++ b/resources/themes/architect/views/auth/login.blade.php @@ -5,33 +5,23 @@ @endsection @section('content') - @if(isset($login_note) AND $login_note) -
- -
NOTE!
- {!! $login_note !!} -
-
- @endisset - - @if (Session::has('error')) -
- Hmm... {{ trans('message.someproblems') }}

- -
- @endif -