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