diff options
author | Matthew Somerville <matthew@mysociety.org> | 2013-02-08 14:09:33 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2013-02-08 14:09:33 +0000 |
commit | 9101b246900446597e0ec3c184cc134f92cca9a1 (patch) | |
tree | 80574cf4fc754f8cdbdb8899d22f2089744687b3 | |
parent | d41b500e09fcc5ca348e9f4f6886bfc1b1e50d8b (diff) |
Separate login/registration to two forms, as it's admin only (fixes a7).
-rw-r--r-- | templates/web/zurich/auth/general.html | 70 | ||||
-rw-r--r-- | web/js/fixmystreet.js | 4 |
2 files changed, 73 insertions, 1 deletions
diff --git a/templates/web/zurich/auth/general.html b/templates/web/zurich/auth/general.html new file mode 100644 index 000000000..42bb09c98 --- /dev/null +++ b/templates/web/zurich/auth/general.html @@ -0,0 +1,70 @@ +[% INCLUDE 'header.html', title = loc('Sign in or create an account') %] + +<h1>[% loc('Sign in') %]</h1> + +[% IF email_error; + + # other keys include fqdn, mxcheck if you'd like to write a custom error message + + errors = { + missing => loc('Please enter your email'), + other => loc('Please check your email address is correct') + }; + + loc_email_error = errors.$email_error || errors.other; +END %] + +<form action="[% c.uri_for() %]" method="post" name="general_auth_login" class="validate"> + <fieldset> + <input type="hidden" name="r" value="[% c.req.params.r | html %]"> + + <div id="form_sign_in_yes" class="form-box"> + + <label class="n" for="email">[% loc('Email') %]</label> + [% IF loc_email_error %] + <div class="form-error">[% loc_email_error %]</div> + [% ELSIF sign_in_error %] + <div class="form-error">[% loc('There was a problem with your email/password combination. If you cannot remember your password, or do not have one, please fill in the ‘sign in by email’ section of the form.') %]</div> + [% END %] + <input type="email" class="required email" id="email" name="email" value="[% email | html %]" placeholder="[% loc('Your email address') %]"> + + <label for="password_sign_in">[% loc('Password (optional)') %]</label> + <div class="form-txt-submit-box"> + <input type="password" class="required" name="password_sign_in" id="password_sign_in" value="" placeholder="[% loc('Your password') %]"> + <input class="green-btn" type="submit" name="sign_in" value="[% loc('Sign in') %]"> + </div> + + <input type="checkbox" id="remember_me" name="remember_me" value='1'[% ' checked' IF remember_me %]> + <label class="inline n" for="remember_me">[% loc('Keep me signed in on this computer') %]</label> + + </div> + </fieldset> +</form> + +<form action="[% c.uri_for() %]" method="post" name="general_auth_register" class="validate"> + <fieldset> + <input type="hidden" name="r" value="[% c.req.params.r | html %]"> + + <h3>[% loc('<strong>No</strong> let me sign in by email') %]</h3> + <div id="form_sign_in_no" class="form-box"> + + <label class="n" for="email2">[% loc('Email') %]</label> + [% IF loc_email_error %] + <div class="form-error">[% loc_email_error %]</div> + [% END %] + <input type="email" class="required email" id="email2" name="email" value="[% email | html %]" placeholder="[% loc('Your email address') %]"> + + <label for="name">[% loc('Name') %]</label> + <input type="text" class="required" name="name" value="" placeholder="[% loc('Your name') %]"> + + <label for="password_register">[% loc('Password (optional)') %]</label> + <div class="form-txt-submit-box"> + <input type="password" class="required" name="password_register" id="password_register" value="" placeholder="[% loc('Enter a password') %]"> + <input class="green-btn" type="submit" name="email_sign_in" value="[% loc('Sign in') %]"> + </div> + + </div> + </fieldset> +</form> + +[% INCLUDE 'footer.html' %] diff --git a/web/js/fixmystreet.js b/web/js/fixmystreet.js index bfa4e90e9..838351e8b 100644 --- a/web/js/fixmystreet.js +++ b/web/js/fixmystreet.js @@ -52,7 +52,8 @@ $(function(){ var form_submitted = 0; var submitted = false; - $("form.validate").validate({ + $("form.validate").each(function(){ + $(this).validate({ rules: validation_rules, messages: translation_strings, onkeyup: false, @@ -85,6 +86,7 @@ $(function(){ submitted = false; }, invalidHandler: function(form, validator) { submitted = true; } + }); }); $('input[type=submit]').click( function(e) { form_submitted = 1; } ); |