Pman.Dialog.VerifyAccess.bjs
[Pman.Core] / Pman.Dialog.VerifyAccess.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.VerifyAccess= function() {}
8 Roo.apply(Pman.Dialog.VerifyAccess.prototype, {
9
10  _strings : {
11   'e2c9d024b79dfb48b42a7807206c6aed' :"Verify New IP Access",
12   'd41d8cd98f00b204e9800998ecf8427e' :"",
13   'b945ed1d61d8edbe16a1192ad6d2fd58' :"Please enter a memorable password for logging into your application",
14   'ee7ad62ad69b9ab5f25d273e4e0a1736' :"Your Username",
15   '51eea3dc60ae3a0b1bb8188bc6337dc2' :"enter password",
16   '1849ffc8731b5e74ae6157c91ba73575' :"Please confirm your password",
17   'd71940f24ee38ee09f6e06b908480bcf' :"Resend email",
18   '14cf5e829f5cb6fbf8cb54f7c5ff4ca9' :"Start the application process   "
19  },
20
21  dialog : false,
22  callback:  false,
23
24  show : function(data, cb)
25  {
26   if (!this.dialog) {
27    this.create();
28   }
29
30   this.callback = cb;
31   this.data = data;
32   this.dialog.show(this.data._el);
33   if (this.form) {
34    this.form.reset();
35    this.form.setValues(data);
36    this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
37   }
38
39  },
40
41  create : function()
42  {
43   var _this = this;
44   this.dialog = Roo.factory({
45     xtype : 'Modal',
46     allow_close : false,
47     cls : 'enable-overflow',
48     title : _this._strings['e2c9d024b79dfb48b42a7807206c6aed'] /* Verify New IP Access */,
49     listeners : {
50      show : function (_self)
51       {
52           var path = window.location.pathname.split('/');
53           
54           var authorized_key = path.pop();
55           
56           var id = path.pop();
57           
58           new Pman.Request({
59               url: baseURL + '/Core/VerifyAccess',
60               method : 'POST',
61               mask : 'Loading...',
62               params : {
63                   id : id,
64                   authorized_key : authorized_key,
65                   _to_data : 1
66               }, 
67               success : function(res) {
68                   Roo.log(res);
69                   return;
70                   _this.form.setValues(res.data);
71                   return;
72               },
73               failure: function(res) {
74                   
75                   _this.dialog.hide();
76                   
77                   Roo.bootstrap.MessageBox.alert('Error', res.errorMsg);
78                   
79                   return;
80              }
81           });
82       }
83     },
84     xns : Roo.bootstrap,
85     '|xns' : 'Roo.bootstrap',
86     buttons : [
87      {
88       xtype : 'Button',
89       html : _this._strings['14cf5e829f5cb6fbf8cb54f7c5ff4ca9'] /* Start the application process    */,
90       weight : 'primary',
91       listeners : {
92        click : function (_self, e)
93         {
94             if(!_this.form.isValid()){
95                 return;
96             }
97             
98             var p1 = _this.form.findField('password').getValue();
99             var p2 = _this.form.findField('password1').getValue();
100             
101             if (p1 != p2) {
102                 _this.form.findField('password1').markInvalid('Password do not match');
103                 return;
104             }
105             
106             _this.dialog.el.mask('Sending...');
107             _this.form.doAction('submit');
108             
109         },
110        render : function (_self)
111         {
112             _this.btn_ok = _self;
113         }
114       },
115       xns : Roo.bootstrap,
116       '|xns' : 'Roo.bootstrap'
117      },
118      {
119       xtype : 'Button',
120       html : _this._strings['d71940f24ee38ee09f6e06b908480bcf'] /* Resend email */,
121       weight : 'primary',
122       listeners : {
123        click : function (_self, e)
124         {
125             var path = window.location.pathname.split('/');
126             
127             var verify_key = path.pop();
128             
129             var id = path.pop();
130             
131             new Pman.Request({
132                 url: baseURL + '/Roo/Coba_application_signup',
133                 method : 'POST',
134                 mask : 'Sending...',
135                 params : {
136                     _resend : id
137                 }, 
138                 success : function(res) {
139                     var msg = "We have re-sent you an invitation via email." +
140                                 "<br/><br/>" + 
141                                 "Please check your inbox for the final registration step." + 
142                                  "<br/><br/>" + 
143                                 "<B>(Note. emails may accidentally be sent to your Spam Folder)</B>";
144                                 
145                     Roo.bootstrap.MessageBox.alert('Please check your email', msg) ;
146                 },
147                 failure: function(res) {
148                     Roo.bootstrap.MessageBox.alert('Error', res.errorMsg) ;
149                 }
150             });
151         },
152        render : function (_self)
153         {
154             _this.btn_resend = _self;
155              this.el.setVisibilityMode(Roo.Element.DISPLAY);
156              this.el.hide();
157         }
158       },
159       xns : Roo.bootstrap,
160       '|xns' : 'Roo.bootstrap'
161      }
162     ],
163     items  : [
164      {
165       xtype : 'Form',
166       errorMask : true,
167       loadMask : false,
168       url : baseURL + '/Register/Confirm',
169       listeners : {
170        actioncomplete : function (_self, action)
171         {
172             if (action.type == 'setdata') {
173             
174                 _this.form.findField('password').focus();
175                 
176                 return;
177             }
178             if (action.type == 'load') {
179                 
180                 return;
181             }
182             if (action.type =='submit') {
183                 
184                 _this.dialog.hide();
185                 
186                 Roo.get(document.body).mask('Start your Application');
187                 
188                 setTimeout(function() {
189                     window.location.href = baseURL;
190                 }, 500); 
191                 
192                 return;
193             }
194             
195         },
196        actionfailed : function (_self, action)
197         {
198             _this.dialog.el.unmask();
199             Roo.log("action failed");
200             Roo.log(action);
201           
202             if(!action.result.errorMsg){
203                 Roo.bootstrap.MessageBox.alert("Error", "Please contact system adminisrator");
204             }
205            
206             var msg = action.result.errorMsg;
207            
208             if(msg.length >= 200){
209                 msg = msg.substring(0,199) + '...'
210             }
211             
212             Roo.bootstrap.MessageBox.alert("Error", msg);
213         },
214        render : function (_self,e)
215         {
216             _this.form = _self;
217             
218         }
219       },
220       xns : Roo.bootstrap,
221       '|xns' : 'Roo.bootstrap',
222       items  : [
223        {
224         xtype : 'Row',
225         xns : Roo.bootstrap,
226         '|xns' : 'Roo.bootstrap',
227         items  : [
228          {
229           xtype : 'Column',
230           xs : 12,
231           xns : Roo.bootstrap,
232           '|xns' : 'Roo.bootstrap',
233           items  : [
234            {
235             xtype : 'Input',
236             fieldLabel : _this._strings['ee7ad62ad69b9ab5f25d273e4e0a1736'] /* Your Username */,
237             labelAlign : 'top',
238             name : 'email',
239             readOnly : true,
240             xns : Roo.bootstrap,
241             '|xns' : 'Roo.bootstrap'
242            }
243           ]
244          }
245         ]
246        },
247        {
248         xtype : 'Row',
249         listeners : {
250          render : function (_self)
251           {
252               _this.row_pwd_label = _self;
253           }
254         },
255         xns : Roo.bootstrap,
256         '|xns' : 'Roo.bootstrap',
257         items  : [
258          {
259           xtype : 'Column',
260           xs : 12,
261           xns : Roo.bootstrap,
262           '|xns' : 'Roo.bootstrap',
263           items  : [
264            {
265             xtype : 'FieldLabel',
266             html : _this._strings['b945ed1d61d8edbe16a1192ad6d2fd58'] /* Please enter a memorable password for logging into your application */,
267             xns : Roo.bootstrap,
268             '|xns' : 'Roo.bootstrap'
269            }
270           ]
271          }
272         ]
273        },
274        {
275         xtype : 'Row',
276         listeners : {
277          render : function (_self)
278           {
279               _this.row_pwd1 = _self;
280           }
281         },
282         xns : Roo.bootstrap,
283         '|xns' : 'Roo.bootstrap',
284         items  : [
285          {
286           xtype : 'Column',
287           xs : 12,
288           xns : Roo.bootstrap,
289           '|xns' : 'Roo.bootstrap',
290           items  : [
291            {
292             xtype : 'SecurePass',
293             allowBlank : false,
294             inputType : 'password',
295             labelAlign : 'top',
296             name : 'password',
297             placeholder : _this._strings['51eea3dc60ae3a0b1bb8188bc6337dc2'] /* enter password */,
298             xns : Roo.bootstrap,
299             '|xns' : 'Roo.bootstrap'
300            }
301           ]
302          }
303         ]
304        },
305        {
306         xtype : 'Row',
307         listeners : {
308          render : function (_self)
309           {
310               _this.row_pwd2 = _self;
311           }
312         },
313         xns : Roo.bootstrap,
314         '|xns' : 'Roo.bootstrap',
315         items  : [
316          {
317           xtype : 'Column',
318           xs : 12,
319           xns : Roo.bootstrap,
320           '|xns' : 'Roo.bootstrap',
321           items  : [
322            {
323             xtype : 'Input',
324             allowBlank : false,
325             inputType : 'password',
326             invalidText : 'The passwords you entered do not match',
327             name : 'password1',
328             placeholder : _this._strings['1849ffc8731b5e74ae6157c91ba73575'] /* Please confirm your password */,
329             validator : function(v){
330                 
331                 if(_this.form.findField('password').getValue() == v) {
332                     
333                     return true;
334                 }
335                 
336                 return false;
337             },
338             xns : Roo.bootstrap,
339             '|xns' : 'Roo.bootstrap'
340            }
341           ]
342          }
343         ]
344        },
345        {
346         xtype : 'Row',
347         xns : Roo.bootstrap,
348         '|xns' : 'Roo.bootstrap',
349         items  : [
350          {
351           xtype : 'Column',
352           xs : 8,
353           xns : Roo.bootstrap,
354           '|xns' : 'Roo.bootstrap',
355           items  : [
356            {
357             xtype : 'Input',
358             inputType : 'hidden',
359             name : 'id',
360             xns : Roo.bootstrap,
361             '|xns' : 'Roo.bootstrap'
362            },
363            {
364             xtype : 'Input',
365             inputType : 'hidden',
366             name : 'verify_key',
367             xns : Roo.bootstrap,
368             '|xns' : 'Roo.bootstrap'
369            }
370           ]
371          }
372         ]
373        }
374       ]
375      },
376      {
377       xtype : 'Row',
378       listeners : {
379        render : function (_self)
380         {
381             _this.error_row = this;
382             
383             this.el.setVisibilityMode(Roo.Element.DISPLAY);
384             
385             this.el.hide();
386         }
387       },
388       xns : Roo.bootstrap,
389       '|xns' : 'Roo.bootstrap',
390       items  : [
391        {
392         xtype : 'Column',
393         xs : 12,
394         xns : Roo.bootstrap,
395         '|xns' : 'Roo.bootstrap',
396         items  : [
397          {
398           xtype : 'Element',
399           html : _this._strings['d41d8cd98f00b204e9800998ecf8427e'] /*  */,
400           listeners : {
401            render : function (_self)
402             {
403                 _this.text_el = _self;
404             }
405           },
406           xns : Roo.bootstrap,
407           '|xns' : 'Roo.bootstrap'
408          }
409         ]
410        }
411       ]
412      }
413     ]
414    }  );
415  }
416 });
417 Roo.apply(Pman.Dialog.VerifyAccess, Pman.Dialog.VerifyAccess.prototype);