diff --git a/browserid/static/dialog/controllers/authenticate_controller.js b/browserid/static/dialog/controllers/authenticate_controller.js index 44d673a884d059a85384e90fd30656f7941cfdf9..a7733d1b53f1c75b3bb1dfd38cc39a7006e83cb5 100644 --- a/browserid/static/dialog/controllers/authenticate_controller.js +++ b/browserid/static/dialog/controllers/authenticate_controller.js @@ -78,7 +78,10 @@ }, "#forgotpassword click": function(event) { - this.close("authenticate:forgotpassword"); + var email = $("#email").val(); + this.close("authenticate:forgotpassword", { + email: email + }); }, "#create click": function(event) { diff --git a/browserid/static/dialog/controllers/dialog_controller.js b/browserid/static/dialog/controllers/dialog_controller.js index e25f69fb5772f1090cdfd90b76804dc025ceeed9..749d3baa1c0a239227f60761d05d01e41f0f0488 100644 --- a/browserid/static/dialog/controllers/dialog_controller.js +++ b/browserid/static/dialog/controllers/dialog_controller.js @@ -71,7 +71,10 @@ PageController.extend("Dialog", {}, { stateMachine: function() { - var self=this, hub = OpenAjax.hub, el = this.element; + var self=this, + hub = OpenAjax.hub, + el = this.element; + hub.subscribe("createaccount:staged", function(msg, info) { self.doConfirmEmail(info.email); @@ -89,8 +92,12 @@ PageController.extend("Dialog", {}, { self.doCreate(); }); */ - hub.subscribe("authenticate:forgotpassword", function() { - self.doForgotPassword(); + hub.subscribe("authenticate:forgotpassword", function(msg, info) { + self.doForgotPassword(info.email); + }); + + hub.subscribe("forgotpassword:reset", function(msg, info) { + self.doConfirmEmail(info.email); }); hub.subscribe("checkregistration:confirmed", function() { @@ -156,8 +163,10 @@ PageController.extend("Dialog", {}, { //this.element.createaccount(); }, - doForgotPassword: function() { - this.element.forgotpassword(); + doForgotPassword: function(email) { + this.element.forgotpassword({ + email: email + }); }, doAddEmail: function() { diff --git a/browserid/static/dialog/controllers/forgotpassword_controller.js b/browserid/static/dialog/controllers/forgotpassword_controller.js index 3f94bb7c1d5182c1cf3affc2e77ea41e6b9f8bd3..bac72557b508710aa66c5ca37896a147beeb46d5 100644 --- a/browserid/static/dialog/controllers/forgotpassword_controller.js +++ b/browserid/static/dialog/controllers/forgotpassword_controller.js @@ -38,72 +38,24 @@ "use strict"; PageController.extend("Forgotpassword", {}, { - init: function() { + init: function(el, options) { this._super({ bodyTemplate: "forgotpassword.ejs", - bodyVars: {}, - footerTemplate: "bottom-continue.ejs", - footerVars: {} + bodyVars: options }); - - $("#create_continue").addClass("disabled"); - - this.setupWatchers(); - }, - - setupWatchers: function() { - var self=this; - function checkInput() { - var pass = $("#password").val(); - var match = pass === $("#password_verify_input").val(); - self.find(".passwordnote").hide(); - $("#create_continue").addClass("disabled"); - if (!match) { - self.find("#passwords_different").show(); - } else { - if (!pass) { - self.find("#enter_a_password").show(); - } else if (pass.length < 8) { - self.find("#password_too_short").show(); - } else if (pass.length > 80) { - self.find("#password_too_long").show(); - } else { - self.find("#password_ok").show(); - $("#create_continue").removeClass("disabled"); - } - } - } - - // watch input dialogs - self.find("input").unbind("keyup").bind("keyup", checkInput); - - // do a check at load time, in case the user is using the back button (enables the continue button!) - checkInput(); - + + $('#formWrap').addClass("standardbg"); }, - validate: function() { - if ($("#create_continue").hasClass("disabled")) - return false; - return true; - }, submit: function() { - // now we need to actually try to stage the creation of this account. - var email = this.find("#email").val(); - var pass = this.find("#password").val(); - - this.doWait(BrowserIDWait.createAccount); + $('#formWrap').removeClass("standardbg"); - var self = this; - BrowserIDIdentities.stageIdentity(email, pass, function(keypair) { - self.close("createaccount:created", { - email: email, - keypair: keypair - }); - }, self.getErrorDialog(BrowserIDErrors.createAccount)); + var email = $('#email_input').val(); + this.close("forgotpassword:reset", { + email: email + }); } - }); }()); diff --git a/browserid/static/dialog/css/popup.css b/browserid/static/dialog/css/popup.css index 9e18e7ec4b21beca50eb670a4138e84357602eaa..c536f7a313598c289e6502e5d1547cbb2243c391 100644 --- a/browserid/static/dialog/css/popup.css +++ b/browserid/static/dialog/css/popup.css @@ -18,6 +18,9 @@ body { font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 13px; line-height: 21px; +} + +.standardbg { background-image: url('/i/bg.png'); } diff --git a/browserid/static/dialog/resources/browserid-network.js b/browserid/static/dialog/resources/browserid-network.js index a003b53acccc6a8f6696f4038ce87993a1fe6c47..30d21274844a47e38f57a833d95e44586991c25e 100644 --- a/browserid/static/dialog/resources/browserid-network.js +++ b/browserid/static/dialog/resources/browserid-network.js @@ -104,7 +104,9 @@ var BrowserIDNetwork = (function() { url: '/wsapi/am_authed', success: function(status, textStatus, jqXHR) { var authenticated = JSON.parse(status); - onSuccess(authenticated); + setTimeout(function() { + onSuccess(authenticated); + }, 10); }, error: onFailure }); diff --git a/browserid/static/dialog/views/forgotpassword.ejs b/browserid/static/dialog/views/forgotpassword.ejs index 974ab45356006dc6ca7479e6c1a1834414e098fa..ce20be18244c8774fefbb5405f8ed52e049cfdc9 100644 --- a/browserid/static/dialog/views/forgotpassword.ejs +++ b/browserid/static/dialog/views/forgotpassword.ejs @@ -1,24 +1,9 @@ - <div class="content"> - <div class="summary"><b>Forgot your password?</b> No problem! Enter your email address, pick a new password, and we'll get you set up again!</div> <div class="formRow"> <label for="email_input"> Email </label> - <input id="email_input" type="email" autocapitalize="off" autocorrect="off" required/> - <span class="note" id="email_input_note" style="display:none;"><span class="good">Not registered</span></span> + <input id="email_input" type="email" value="<%= email %>"/> </div> - <div class="formRow"> - <label for="password_input"> Password </label> - <input id="password_input" type="password" pattern=".{5,}" required/> - </div> - <div class="formRow"> - <label for="password_verify_input"> Verify </label> - <input id="password_verify_input" type="password" pattern=".{5,}" required/> - <span class="note passwordnote" id="enter_a_password"><span class="bad">Enter a password</span></span> - <span class="note passwordnote" id="passwords_different" style="display:none;"><span class="bad">Passwords different</span></span> - <span class="note passwordnote" id="password_too_short" style="display:none;"><span class="bad">Password too short</span></span> - <span class="note passwordnote" id="password_too_long" style="display:none;"><span class="bad">Password too long</span></span> - <span class="note passwordnote" id="password_ok" style="display:none;"><span class="good">Password OK</span></span> - </div> - <div class="attention_lame" style="display:none;" id="emailinuse_message"> - <span id="in_use_email">Email</span> in use, If this email is yours you can <a tabindex="0" href="#">sign in</a> with it? + + <div class="submit cf"> + <button>Reset Password</button> </div> - </div> + diff --git a/browserid/views/dialog.ejs b/browserid/views/dialog.ejs index 5c10bd84e59b3a62bf9c97e380017d6a3620f4ed..70867f5da700dc0c4241d3ba11599e6c4194ccef 100644 --- a/browserid/views/dialog.ejs +++ b/browserid/views/dialog.ejs @@ -9,7 +9,7 @@ <link href='http://fonts.googleapis.com/css?family=Droid+Serif:400,400italic,700,700italic' rel='stylesheet' type='text/css'> <title>Browser ID</title> </head> - <body> + <body class="standardbg"> </body> </html> <script type='text/javascript' src='/vepbundle'></script>