Enable login by any attribute - defaults to uid.

Implements #253
This commit is contained in:
2024-01-08 14:54:00 +11:00
parent ef355e8193
commit 74bd996f7a
5 changed files with 31 additions and 4 deletions

View File

@@ -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
View 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'));
}