Mercurial > hg > fapweb
changeset 304:7181350076c1
Change how user login errors are handled.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 26 Nov 2013 06:27:06 +0200 |
parents | 734781881e47 |
children | b96c41bd9dd6 |
files | loginerror.inc.php usrlogin.php vote.inc.php |
diffstat | 3 files changed, 35 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/loginerror.inc.php Tue Nov 26 06:15:52 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -<h1>Voting system login failed</h1> -<p> -The vote key was not valid. <a href="vote">Try again</a>. -</p>
--- a/usrlogin.php Tue Nov 26 06:15:52 2013 +0200 +++ b/usrlogin.php Tue Nov 26 06:27:06 2013 +0200 @@ -32,7 +32,7 @@ if (!stSessionStart(SESS_USER, $password, "userTimeout")) { error_log("User session AUTH LOGIN failed (session setup)"); - $gotoPage = "loginerror"; + $gotoPage = "vote?error=2"; } else stSetSessionItem("mode", stGetRequestItem("mode", "error")); @@ -40,7 +40,7 @@ else { error_log("User session AUTH LOGIN failed (password)"); - $gotoPage = "loginerror"; + $gotoPage = "vote?error=1"; } header("Location: ".($gotoPage !== FALSE ? $gotoPage : stGetSetting("defaultPage")));
--- a/vote.inc.php Tue Nov 26 06:15:52 2013 +0200 +++ b/vote.inc.php Tue Nov 26 06:27:06 2013 +0200 @@ -29,9 +29,40 @@ { // Perform authentication if we are not in session already $userKeyLen = stGetSetting("userKeyLength"); + + if (($error = stGetRequestItem("error", 0)) != 0) + { + echo + "<h1>Voting system login failed</h1>\n". + "<p class=\"notice\">\n"; + + switch ($error) + { + case 1: + echo "The votekey does not exist. Please try again."; + break; + + case 2: + echo "There was an error in the system. Contact an administrator."; + break; + + case 3: + echo + "The votekey is not yet activated, try again later. If ". + "you are certain that it should be working now, go pester an organizer."; + break; + } + + echo + "</p>\n"; + } + else + { + echo + "<h1>Voting system</h1>\n"; + } + echo - "<h1>Voting system</h1>\n". - (stGetSessionItem("mode") == "error" ? "<p>ERROR occured, try again</p>." : ""). stGetFormStart("vote", "usrlogin.php"). " ".stGetFormHiddenInput("mode", "vote")."\n". " ".stGetFormHiddenInput("goto", "vote")."\n".