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