From: rjk@greenend.org.uk <> Date: Mon, 31 Dec 2007 09:54:21 +0000 (+0000) Subject: Tidy up login reporting. X-Git-Tag: 3.0~129 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/commitdiff_plain/ac152d06f4cfa9abcd4a88de7dbc6a9040f99c0d?hp=ab29cd16e4e09767e955896c9c92c9ef6e649a9a Tidy up login reporting. The various login-page actions now set the label 'status' to their result and this is used to pick the right label for the response text. The interpretation of 'back' is fixed too. --- diff --git a/server/dcgi.c b/server/dcgi.c index d54160e..27c77b1 100644 --- a/server/dcgi.c +++ b/server/dcgi.c @@ -477,7 +477,8 @@ static void act_login(cgi_sink *output, } /* We have a new cookie */ header_cookie(output->sink); - if((back = cgi_get("back")) && back) + cgi_set_option("status", "loginok"); + if((back = cgi_get("back")) && *back) /* Redirect back to somewhere or other */ redirect(output->sink); else @@ -492,6 +493,7 @@ static void act_logout(cgi_sink *output, /* Reconnect as guest */ disorder_cgi_login(ds, output); /* Back to the login page */ + cgi_set_option("status", "logoutok"); expand_template(ds, output, "login"); } @@ -545,7 +547,7 @@ static void act_register(cgi_sink *output, sendmail("", config->mail_sender, email, "Welcome to DisOrder", encoding, content_type, text); /* TODO error checking */ /* We'll go back to the login page with a suitable message */ - cgi_set_option("registered", "registeredok"); + cgi_set_option("status", "registered"); expand_template(ds, output, "login"); } @@ -561,7 +563,7 @@ static void act_confirm(cgi_sink *output, cgi_set_option("error", "badconfirm"); expand_template(ds, output, "login"); } - cgi_set_option("confirmed", "confirmedok"); + cgi_set_option("status", "confirmed"); expand_template(ds, output, "login"); } diff --git a/templates/login.html b/templates/login.html index 8f366bb..65f1939 100644 --- a/templates/login.html +++ b/templates/login.html @@ -33,12 +33,12 @@ USA

@label{error.@label:error@}@

}@ - @if{@ne{@label:registered@}{registered}@}{ - @#{registration succeeded}@ -

@label:login.registered@

+ @if{@ne{@label:status@}{status}@}{ + @#{some action succeeded}@ +

@label{login.@label:status@}@

}@ - +

User: @user@

@if{@eq{@user@}{guest}@}{ @#{guest user, allow login and registration}@ @@ -101,7 +101,7 @@ USA size=32> diff --git a/templates/options.labels b/templates/options.labels index 249d6ae..b62a918 100644 --- a/templates/options.labels +++ b/templates/options.labels @@ -144,7 +144,12 @@ label login.email "Email address" label login.login "Login" label login.register "Register" label login.edituser "Change Details" -label login.lougout "Logout" +label login.logout "Logout" + +label login.loginok "Logged in OK" +label login.logoutok "Logged out OK" +label login.registered "Registered your new login" +label login.confirmed "Confirmed your new login" # for account page label account.title "DisOrder User Details"