68 lines
2.3 KiB
PHP
68 lines
2.3 KiB
PHP
<?=$this->layout('login_tpl', ['title' => $title])?>
|
|
<?=$this->start('content')?>
|
|
<form method="post" name="auth_submit" id="auth_submit">
|
|
<p align="center" style="padding: 0px 10px;"><?=_('Check your email for get instructions for complete login with double auth or')?> <a href="<?=$this->make_url('admin', 'app', ['logout'])?>">logout</a> and login again with other user</p>
|
|
<p><label for="auth_code"></label><input type="text" name="auth_code" id="auth_code_form" placeholder="<?=_('Code')?>"/></p>
|
|
<p class="error" id="auth_code_error"></p>
|
|
<?=PhangoApp\PhaUtils\Utils::set_csrf_key($name_token='csrf_token', $length_token=80)?>
|
|
<p>
|
|
<input type="submit" id="button_submit" class="button" value="<?=_('Send auth code')?>" />
|
|
</p>
|
|
</form>
|
|
<?=$this->end('content')?>
|
|
<?=$this->start('footer_js')?>
|
|
<script language="Javascript">
|
|
$(document).ready( function () {
|
|
|
|
$("#auth_submit").submit( function () {
|
|
|
|
$('.error').html('');
|
|
|
|
$('#loader-wrapper').show();
|
|
|
|
$.ajax({
|
|
url: "<?=$this->make_url('admin', 'app', ['check_auth'])?>",
|
|
method: "POST",
|
|
dataType: "json",
|
|
data: {'auth_code': $('#auth_code_form').val()},
|
|
success: function (data) {
|
|
|
|
if(data.error==0)
|
|
{
|
|
console.log('Success');
|
|
|
|
$('#loader-wrapper').hide();
|
|
|
|
location.href="<?=$this->make_url('admin')?>";
|
|
|
|
}
|
|
else
|
|
{
|
|
|
|
$('#loader-wrapper').hide();
|
|
|
|
$('#csrf_token').attr('value', data.csrf_token);
|
|
|
|
$('#auth_code_error').html(data.error_form.auth_code_error);
|
|
}
|
|
|
|
},
|
|
error: function (data) {
|
|
|
|
$('#loader-wrapper').hide();
|
|
|
|
alert('Error');
|
|
|
|
console.log(data);
|
|
|
|
}
|
|
});
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
|
});
|
|
</script>
|
|
<?=$this->end('footer_js')?>
|