feat(admin): remember login for 90 days and support REG SSH limits
deploy-preland / deploy zoomstage.online (push) Successful in 57s
deploy-preland / deploy zoomstage.online (push) Successful in 57s
This commit is contained in:
1 parent
d04b40519e
commit
522aaf8554
13 files changed
+316
-27
No files matched your search
@@ -19,7 +19,10 @@ try {
|
||||
if($raw!==''){$object=json_decode($raw,false,32,JSON_THROW_ON_ERROR);if(!$object instanceof stdClass)throw new Problem('Ожидался объект запроса.');$data=(array)$object;}
|
||||
}else $data=$_POST;
|
||||
}
|
||||
if($path==='/api/login'&&$method==='POST')reply($auth->login((string)($data['username']??''),(string)($data['password']??''),$_SERVER['REMOTE_ADDR']??'unknown'));
|
||||
if($path==='/api/login'&&$method==='POST'){
|
||||
if(array_key_exists('remember',$data)&&!is_bool($data['remember']))throw new Problem('Поле «Запомнить меня» должно быть логическим значением.');
|
||||
reply($auth->login((string)($data['username']??''),(string)($data['password']??''),$_SERVER['REMOTE_ADDR']??'unknown',$data['remember']??false));
|
||||
}
|
||||
$user=$auth->requireUser();
|
||||
if($method!=='GET')$auth->csrf($_SERVER['HTTP_X_CSRF_TOKEN']??'');
|
||||
if($path==='/api/logout'&&$method==='POST'){$auth->logout();reply([]);}
|
||||
|
||||
Reference in new issue
Block a user