2 name: "blerg.ForgotPasswordDialog",
4 classes: "blerg-dialog",
10 {tag: "h2", content: "Forgot Password"},
11 {name: "spinner", kind: "OldSchoolSpinner", showing: false, style: "position: absolute; top: 8px; right: 8px;"},
12 {kind: "onyx.Groupbox", components: [
13 {kind: "onyx.InputDecorator", components: [
14 {name: "username", kind: "onyx.Input", placeholder: "Username"}
16 {kind: "onyx.InputDecorator", components: [
17 {name: "email", kind: "onyx.Input", placeholder: "Email Address"}
20 {name: "recoverError", tag: "p", showing: false, classes: 'blerg-error', content: "Please enter both username and email."},
21 {name: "recoverButton", kind: "onyx.Button", content: "Send Recovery Email", onclick: "recoverClick", classes: "onyx-affirmative"},
22 {kind: "onyx.Button", content: "Cancel", onclick: "cancelClick", classes: "onyx-negative"}
24 recoverClick: function() {
25 var username = this.$.username.getValue();
26 var email = this.$.email.getValue();
28 if (!(username != '' && email != '')) {
29 this.$.recoverError.show();
33 this.$.recoverButton.setDisabled(true);
34 this.$.spinner.show();
35 this.$.spinner.start();
37 var req = new enyo.Ajax({
38 url: '/aux/recovery/mail',
46 req.response(this, function(inSender, inResponse) {
47 this.$.spinner.stop();
48 this.$.spinner.hide();
49 this.$.recoverButton.setDisabled(false);
51 if (inResponse.status == 'success') {
52 alert("Recovery email sent");
57 req.error(this, function(inSender, inResponse) {
58 this.$.spinner.stop();
59 this.$.spinner.hide();
60 this.$.recoverButton.setDisabled(false);
62 alert("Failed due to backend error");
67 cancelClick: function() {
68 this.$.username.setValue('');
69 this.$.email.setValue('');
72 setUsername: function(v) {
73 this.$.username.setValue(v);