mirror of
https://github.com/maxpozdeev/mytinytodo.git
synced 2026-03-11 08:55:27 +00:00
add ajax action to get csrf token (for external authentication)
This commit is contained in:
parent
4a41ad0467
commit
291708692b
1 changed files with 18 additions and 1 deletions
19
src/ajax.php
19
src/ajax.php
|
|
@ -309,7 +309,7 @@ elseif(isset($_POST['login']))
|
|||
}
|
||||
if ( isPasswordEqualsToHash(_post('password'), Config::get('password')) ) {
|
||||
updateSessionLogged(true);
|
||||
update_token();
|
||||
$t['token'] = update_token();
|
||||
$t['logged'] = 1;
|
||||
}
|
||||
jsonExit($t);
|
||||
|
|
@ -541,6 +541,23 @@ elseif(isset($_GET['setHideList']))
|
|||
}
|
||||
jsonExit(array('total'=>1));
|
||||
}
|
||||
elseif (isset($_POST['createSession']))
|
||||
{
|
||||
$t = array();
|
||||
if (!need_auth()) {
|
||||
$t['disabled'] = 1;
|
||||
jsonExit($t);
|
||||
}
|
||||
if (access_token() == '') {
|
||||
update_token();
|
||||
}
|
||||
$t['token'] = access_token();
|
||||
$t['session'] = session_id();
|
||||
jsonExit($t);
|
||||
}
|
||||
else {
|
||||
jsonExit(['total' => 0]);
|
||||
}
|
||||
|
||||
|
||||
###################################################################################################
|
||||
|
|
|
|||
Loading…
Reference in a new issue