5b992c5fb7c51b5b2eb8d04bbbdc1beff97868a1
[Pman.BAdmin] / Pman.Dialog.BAdminPasswordReset.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5 Roo.namespace('Pman.Dialog');
6
7 Pman.Dialog.BAdminPasswordReset= function() {}
8 Roo.apply(Pman.Dialog.BAdminPasswordReset.prototype, {
9
10  _strings : {
11   'acd43bedab51b6704bf10d9ac136a032' :"Reset management password",
12   '10ac3d04253ef7e1ddc73e6091c0cd55' :"Next",
13   'bbddd6ba0948d79e55486e615a265b56' :"Enter your new password",
14   'c4ca4238a0b923820dcc509a6f75849b' :"1",
15   '6d70a993714d2699e1d30e03d2753850' :"Please enter again to confirm"
16  },
17  _named_strings : {
18   'ResetPassword_value' : 'c4ca4238a0b923820dcc509a6f75849b' /* 1 */ ,
19   'ok_html' : '10ac3d04253ef7e1ddc73e6091c0cd55' /* Next */ ,
20   'password2_fieldLabel' : '6d70a993714d2699e1d30e03d2753850' /* Please enter again to confirm */ ,
21   'password1_fieldLabel' : 'bbddd6ba0948d79e55486e615a265b56' /* Enter your new password */ 
22  },
23
24  dialog : false,
25  callback:  false,
26
27  show : function(data, cb)
28  {
29   if (!this.dialog) {
30    this.create();
31   }
32
33   this.callback = cb;
34   this.data = data;
35   this.dialog.show(this.data._el);
36   if (this.form) {
37    this.form.reset();
38    this.form.setValues(data);
39    this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
40   }
41
42  },
43
44  create : function()
45  {
46   var _this = this;
47   this.dialog = Roo.factory({
48     xtype : 'Modal',
49     animate : false,
50     buttonPosition : 'center',
51     cls : 'enable-overflow roo-bootstrap-dialog',
52     title : _this._strings['acd43bedab51b6704bf10d9ac136a032'] /* Reset management password */,
53     listeners : {
54      show : function (_self)
55       {
56           _this.dialog.el.select('.modal-content', true).first().unmask();
57           _this.form.findField('password1').focus();
58       }
59     },
60     xns : Roo.bootstrap,
61     '|xns' : 'Roo.bootstrap',
62     buttons : [
63      {
64       xtype : 'Button',
65       html : _this._strings['10ac3d04253ef7e1ddc73e6091c0cd55'] /* Next */,
66       name : 'ok',
67       weight : 'primary',
68       listeners : {
69        click : function (_self, e)
70         {
71             _this.dialog.el.select('.modal-content', true).first().mask('Sending...');
72             _this.form.doAction('submit');
73         }
74       },
75       xns : Roo.bootstrap,
76       '|xns' : 'Roo.bootstrap'
77      }
78     ],
79     items  : [
80      {
81       xtype : 'Row',
82       xns : Roo.bootstrap,
83       '|xns' : 'Roo.bootstrap',
84       items  : [
85        {
86         xtype : 'Container',
87         cls : 'col-md-12',
88         xns : Roo.bootstrap,
89         '|xns' : 'Roo.bootstrap',
90         items  : [
91          {
92           xtype : 'Form',
93           labelAlign : 'top',
94           loadMask : false,
95           method : 'POST',
96           style : 'padding: 10px;',
97           url : baseURL + '/Login',
98           verifyCheckSum : function() 
99           { 
100               _this.dialog.hide();
101               
102               new Pman.Request({
103                   url: baseURL + '/Login',
104                   method : 'POST',
105                   mask : 'Verifying...',
106                   params : {
107                       id : _this.form.findField('id').getValue(),
108                       ts : _this.form.findField('ts').getValue(),
109                       key : _this.form.findField('key').getValue(),
110                       _verifyCheckSum : 1
111                   },
112                   success : function(res) {
113                       _this.dialog.show();
114                   }
115               });
116           },
117           listeners : {
118            actioncomplete : function (_self, action) {
119             
120                 if (action.type == 'setdata') {
121                     
122                     var pathname = window.location.pathname.split('PasswordReset/');
123                     
124                     if(typeof(pathname[1]) == 'undefined'){
125                         return;
126                     }
127                     
128                     var data = pathname[1].split('/');
129                     
130                     if(data.length != 3){
131                         _this.dialog.hide();
132                         Roo.bootstrap.MessageBox.alert('Sorry', 'Account reset link is not correct - please try again or paste the link correctly');
133                         return;
134                     }
135                     
136                     _this.form.findField('id').setValue(data[0]);
137                     _this.form.findField('ts').setValue(data[1]);
138                     _this.form.findField('key').setValue(data[2]);
139                 
140                     _this.form.clearInvalid();
141                 
142                     _this.form.verifyCheckSum();
143                     
144                     return;
145                 }
146                 if (action.type == 'load') {
147                      
148                     return;
149                 }
150                 if (action.type =='submit') {
151                     
152                     _this.dialog.hide();
153                     
154                     if (_this.callback) {
155                         _this.callback.call(_this, action.result);
156                     }
157                     
158                     _this.form.reset();
159                     
160                     return;
161                     
162                 }
163             },
164            actionfailed : function (_self, action) {
165             
166                 Roo.log('action fail?');
167                 Roo.log(action);
168                 
169                 _this.dialog.el.select('.modal-content', true).first().unmask();
170                 
171                 var err = 'Fill in all the required fields';
172                 
173                 if (typeof(action) != 'undefined' && action.failureType == 'server') {
174                     err = action.result.errorMsg;
175                 }
176                 
177                 Roo.bootstrap.MessageBox.alert('Error', err);
178             },
179            render : function (_self) {
180                 _this.form = _self;
181             }
182           },
183           xns : Roo.bootstrap,
184           '|xns' : 'Roo.bootstrap',
185           items  : [
186            {
187             xtype : 'Row',
188             xns : Roo.bootstrap,
189             '|xns' : 'Roo.bootstrap',
190             items  : [
191              {
192               xtype : 'Column',
193               xs : 12,
194               xns : Roo.bootstrap,
195               '|xns' : 'Roo.bootstrap',
196               items  : [
197                {
198                 xtype : 'Input',
199                 allowBlank : false,
200                 fieldLabel : _this._strings['bbddd6ba0948d79e55486e615a265b56'] /* Enter your new password */,
201                 inputType : 'password',
202                 name : 'password1',
203                 listeners : {
204                  specialkey : function (_self, e)
205                   {
206                       if(e.getKey() == 13){
207                           _this.dialog.el.select('.modal-content', true).first().mask('Sending...');
208                           _this.form.doAction('submit');
209                       }
210                   }
211                 },
212                 xns : Roo.bootstrap,
213                 '|xns' : 'Roo.bootstrap'
214                },
215                {
216                 xtype : 'Input',
217                 allowBlank : false,
218                 fieldLabel : _this._strings['6d70a993714d2699e1d30e03d2753850'] /* Please enter again to confirm */,
219                 inputType : 'password',
220                 name : 'password2',
221                 listeners : {
222                  specialkey : function (_self, e)
223                   {
224                       if(e.getKey() == 13){
225                           _this.dialog.el.select('.modal-content', true).first().mask('Sending...');
226                           _this.form.doAction('submit');
227                       }
228                   }
229                 },
230                 xns : Roo.bootstrap,
231                 '|xns' : 'Roo.bootstrap'
232                },
233                {
234                 xtype : 'Input',
235                 inputType : 'hidden',
236                 name : 'id',
237                 xns : Roo.bootstrap,
238                 '|xns' : 'Roo.bootstrap'
239                },
240                {
241                 xtype : 'Input',
242                 inputType : 'hidden',
243                 name : 'ts',
244                 xns : Roo.bootstrap,
245                 '|xns' : 'Roo.bootstrap'
246                },
247                {
248                 xtype : 'Input',
249                 inputType : 'hidden',
250                 name : 'key',
251                 xns : Roo.bootstrap,
252                 '|xns' : 'Roo.bootstrap'
253                },
254                {
255                 xtype : 'Input',
256                 inputType : 'hidden',
257                 name : 'ResetPassword',
258                 value : 1,
259                 xns : Roo.bootstrap,
260                 '|xns' : 'Roo.bootstrap'
261                }
262               ]
263              }
264             ]
265            }
266           ]
267          }
268         ]
269        }
270       ]
271      }
272     ]
273    }  );
274  }
275 });
276 Roo.apply(Pman.Dialog.BAdminPasswordReset, Pman.Dialog.BAdminPasswordReset.prototype);