2 name: "blerg.AccountCenter",
4 locationDetect: function(l) {
5 var m = l.hash.match(/^#\/account$/);
8 kind: 'blerg.AccountCenter'
14 onLogin: "loginStatusChange",
15 onLogout: "loginStatusChange"
18 {name: 'accountCenterContent', showing: false, components: [
19 {tag: 'h2', content: "Change Password"},
20 {kind: "blerg.PasswdForm"},
21 {tag: 'h2', content: "Email"},
22 {kind: 'blerg.EmailForm'},
23 {tag: 'h2', content: "Generate recovery link"},
24 {content: "A recovery link is a URL that will allow you to reset the password on your account at a later time. Whoever has this link will be able to gain control of your account. This link should be kept in a safe place like an encrypted password manager or a physical piece of paper locked in a safe. The link will expire after one year or the next password change (either via a recovery link or by changing it manually above). To indicate that you understand this, please copy <code>blërg</code> into the textbox below.", tag: 'p', allowHtml: true},
25 {tag: 'form', onsubmit: 'generateRecoveryLink', components: [
26 {kind: 'onyx.InputDecorator', classes: "recovery", components: [
27 {kind: 'onyx.Input', name: "recoveryVerifier"}
29 {kind: 'onyx.Button', content: "Generate", classes: "recovery", onclick: "generateRecoveryLink"}
31 {tag: 'p', name: 'recoveryLinkOutput', classes: 'recovery'}
33 {name: 'pleaseLogIn', content: 'Please log in above to use the Account Center.'}
36 this.inherited(arguments);
37 this.bubble('onSetTitle', {section: 'Account Center'});
38 this.loginStatusChange();
40 generateRecoveryLink: function(inSender, inEvent) {
41 if (this.$.recoveryVerifier.getValue() != 'blërg') {
42 this.$.recoveryLinkOutput.setContent('Please read the text above');
46 var req = new enyo.Ajax({
47 url: '/aux/recovery/new',
51 req.response(this, function(inSender, inResponse) {
52 this.$.recoveryLinkOutput.setContent(inResponse);
55 req.error(this, function(inSender, inResponse) {
56 this.$.recoveryLinkOutput.setContent('Failed: ' + req.xhrResponse.status);
61 loginStatusChange: function(inSender, inEvent) {
62 this.$.pleaseLogIn.setShowing(!blerg.API.loggedIn);
63 this.$.accountCenterContent.setShowing(blerg.API.loggedIn);