parent
ef355e8193
commit
74bd996f7a
@ -45,7 +45,7 @@ class LoginController extends Controller
|
||||
protected function credentials(Request $request): array
|
||||
{
|
||||
return [
|
||||
'mail' => $request->get('email'),
|
||||
login_attr_name() => $request->get(login_attr_name()),
|
||||
'password' => $request->get('password'),
|
||||
];
|
||||
}
|
||||
@ -91,4 +91,14 @@ class LoginController extends Controller
|
||||
|
||||
return view('architect::auth.login')->with('login_note',$login_note);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the login username to be used by the controller.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function username()
|
||||
{
|
||||
return login_attr_name();
|
||||
}
|
||||
}
|
||||
|
13
app/helpers.php
Normal file
13
app/helpers.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
function login_attr_description(): string
|
||||
{
|
||||
return Arr::get(config('ldap.login.attr'),login_attr_name());
|
||||
}
|
||||
|
||||
function login_attr_name(): string
|
||||
{
|
||||
return key(config('ldap.login.attr'));
|
||||
}
|
@ -22,6 +22,9 @@
|
||||
"phpunit/phpunit": "^10.0"
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"app/helpers.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"App\\": "app/",
|
||||
"Database\\Factories\\": "database/factories/",
|
||||
|
@ -109,6 +109,7 @@ return [
|
||||
* setup.
|
||||
*/
|
||||
'login' => [
|
||||
'attr' => [env('LDAP_LOGIN_ATTR','uid') => env('LDAP_LOGIN_ATTR_DESC','User ID')], // Attribute used to find user for login
|
||||
'objectclass' => explode(',',env('LDAP_LOGIN_OBJECTCLASS', 'posixAccount')), // Objectclass that users must contain to login
|
||||
],
|
||||
|
||||
|
@ -35,10 +35,10 @@
|
||||
|
||||
<div class="form-row">
|
||||
<div class="col-md-12 mt-3">
|
||||
<label class="mb-1">Email</label>
|
||||
<input name="email" id="user" placeholder="" type="email" class="form-control" required="">
|
||||
<label class="mb-1">{{ login_attr_description() }}</label>
|
||||
<input name="{{ login_attr_name() }}" id="user" placeholder="" type="@if(in_array(login_attr_name(),['mail','email'])) email @else text @endif" class="form-control" required="">
|
||||
<div class="invalid-feedback">
|
||||
@lang('Please enter your email')
|
||||
@lang('Please enter your '.strtolower(login_attr_description()))
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user