2 name: "blerg.PasswdDialog",
4 classes: "blerg-dialog",
10 {tag: "h2", content: "Change 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: "oldpassword", kind: "onyx.Input", placeholder: "Old Password", type: "password"}
17 {kind: "onyx.Groupbox", components: [
18 {kind: "onyx.InputDecorator", components: [
19 {name: "password1", kind: "onyx.Input", placeholder: "New Password", type: "password"}
21 {kind: "onyx.InputDecorator", components: [
22 {name: "password2", kind: "onyx.Input", placeholder: "New Password (again)", type: "password"}
25 {name: "changePasswordError", tag: "p", showing: false, classes: "blerg-error", content: "I couldn't change your password. Are you sure you have the right old password?"},
26 {name: "passwordMatchError", tag: "p", showing: false, classes: "blerg-error", content: "Your new passwords don't match."},
27 {name: "changeButton", kind: "onyx.Button", content: "Change", onclick: "changeClick", classes: "onyx.affirmative"},
28 {kind: "onyx.Button", content: "Cancel", onclick: "cancelClick", classes: "onyx-negative"},
29 {name: "api", kind: "blerg.API",
30 onPasswordChangeSuccessful: "passwordChangeSuccessful",
31 onPasswordChangeFailed: "passwordChangeFailed"}
33 hideErrors: function() {
34 this.$.changePasswordError.hide();
35 this.$.passwordMatchError.hide();
37 changeClick: function() {
39 if (this.$.oldpassword.getValue() == '') {
40 this.$.changePasswordError.show();
43 if (this.$.password1.getValue() != this.$.password2.getValue()) {
44 this.$.passwordMatchError.show();
47 this.$.changeButton.setDisabled(true);
48 this.$.spinner.show();
49 this.$.spinner.start();
50 this.$.api.changePassword(this.$.oldpassword.getValue(), this.$.password1.getValue());
52 cancelClick: function() {
55 passwordChangeSuccessful: function(inSender, inEvent) {
56 this.$.oldpassword.setValue('');
57 this.$.password1.setValue('');
58 this.$.password2.setValue('');
59 this.$.changeButton.setDisabled(false);
60 this.$.spinner.hide();
61 this.$.spinner.stop();
63 alert("Password Changed Successfully");
65 passwordChangeFailed: function(inSender, inEvent) {
66 this.$.changeButton.setDisabled(false);
67 this.$.spinner.hide();
68 this.$.spinner.stop();
70 this.$.changePasswordError.show();