mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-19 00:01:00 +08:00
show passkey login URL at usercp
This commit is contained in:
@@ -46,12 +46,15 @@ class AuthenticateController extends Controller
|
||||
|
||||
public function passkeyLogin($passkey)
|
||||
{
|
||||
$user = User::query()->where('passkey', $passkey)->first(['id', 'passhash']);
|
||||
if ($user) {
|
||||
$passhash = md5($user->passhash . $_SERVER["REMOTE_ADDR"]);
|
||||
logincookie($user->id, $passhash,false,0x7fffffff, true, true, true);
|
||||
$user->last_login = now();
|
||||
$user->save();
|
||||
$deadline = Setting::get('security.login_secret_deadline');
|
||||
if ($deadline && $deadline > now()->toDateTimeString()) {
|
||||
$user = User::query()->where('passkey', $passkey)->first(['id', 'passhash']);
|
||||
if ($user) {
|
||||
$passhash = md5($user->passhash . $_SERVER["REMOTE_ADDR"]);
|
||||
logincookie($user->id, $passhash,false,0x7fffffff, true, true, true);
|
||||
$user->last_login = now();
|
||||
$user->save();
|
||||
}
|
||||
}
|
||||
return redirect('index.php');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user