2 name: "blerg.PasswdForm",
5 {kind: "onyx.Groupbox", components: [
6 {kind: "onyx.InputDecorator", components: [
7 {name: "oldpassword", kind: "onyx.Input", placeholder: "Old Password", type: "password"}
10 {kind: "onyx.Groupbox", components: [
11 {kind: "onyx.InputDecorator", components: [
12 {name: "password1", kind: "onyx.Input", placeholder: "New Password", type: "password"}
14 {kind: "onyx.InputDecorator", components: [
15 {name: "password2", kind: "onyx.Input", placeholder: "New Password (again)", type: "password"}
18 {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?"},
19 {name: "passwordMatchError", tag: "p", showing: false, classes: "blerg-error", content: "Your new passwords don't match."},
20 {name: "changeButton", kind: "onyx.Button", content: "Change", onclick: "changeClick", classes: "onyx.affirmative"},
21 {name: "spinner", kind: "OldSchoolSpinner", showing: false},
22 {name: "api", kind: "blerg.API",
23 onPasswordChangeSuccessful: "passwordChangeSuccessful",
24 onPasswordChangeFailed: "passwordChangeFailed"}
26 hideErrors: function() {
27 this.$.changePasswordError.hide();
28 this.$.passwordMatchError.hide();
30 changeClick: function() {
32 if (this.$.oldpassword.getValue() == '') {
33 this.$.changePasswordError.show();
36 if (this.$.password1.getValue() != this.$.password2.getValue()) {
37 this.$.passwordMatchError.show();
40 this.$.changeButton.setDisabled(true);
41 this.$.spinner.show();
42 this.$.spinner.start();
43 this.$.api.changePassword(this.$.oldpassword.getValue(), this.$.password1.getValue());
45 passwordChangeSuccessful: function(inSender, inEvent) {
46 this.$.oldpassword.setValue('');
47 this.$.password1.setValue('');
48 this.$.password2.setValue('');
49 this.$.changeButton.setDisabled(false);
50 this.$.spinner.hide();
51 this.$.spinner.stop();
52 alert("Password Changed Successfully");
54 passwordChangeFailed: function(inSender, inEvent) {
55 this.$.changeButton.setDisabled(false);
56 this.$.spinner.hide();
57 this.$.spinner.stop();
59 this.$.changePasswordError.show();