Reshuffle login flow to hopefully make things more robust

This commit is contained in:
RunasSudo 2017-11-28 14:45:54 +11:00
parent 8ba413b317
commit 39246d5df0
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
3 changed files with 22 additions and 5 deletions

View File

@ -76,6 +76,7 @@
$("#cast_button").show();
$("#booth_logged_in_as").text("You are currently logged in as " + username + ".");
castBallot();
return true;
}
function castBallot() {

View File

@ -42,6 +42,7 @@
function callback_complete(name) {
window.location = "/";
return true;
}
</script>
{% endblock %}

View File

@ -23,18 +23,33 @@
{% block basecontent %}
<div class="ui middle aligned center aligned grid" style="height: 100%;">
<div class="column" style="max-width: 400px;">
<div class="ui success message">
<div class="ui hidden success message">
<div class="header">Log in successful</div>
<p>You have successfully logged in to your account.</p>
<p>You may now close this window and return to your previous page.</p>
</div>
<div class="ui hidden error message">
<div class="header">Error logging in</div>
<p>Your log in details appear to be correct, however there was an unknown error while logging you in.</p>
<p>Please close this window try again. If the problem persists, contact your election administrator.</p>
</div>
</div>
</div>
<script>
try {
var result = window.opener.callback_complete("{{ session.user.name }}");
if (result) {
$(".success.message").removeClass("hidden");
window.setTimeout(function() {
window.close();
window.opener.callback_complete("{{ session.user.name }}");
}, 1000);
} else {
$(".error.message").removeClass("hidden");
}
} catch (ex) {
$(".error.message").removeClass("hidden");
}
</script>
{% endblock %}