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