Pman.Dialog.BAdminStaffTwoFactorQRCode.bjs
[Pman.BAdmin] / Pman.Dialog.BAdminStaffTwoFactorQRCode.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.BAdminStaffTwoFactorQRCode= function() {}
8 Roo.apply(Pman.Dialog.BAdminStaffTwoFactorQRCode.prototype, {
9
10  _strings : {
11   'dc7b0c7f9d3941532bda06cd58eec7bd' :"<ol class='qr-list' start=\"1\">\n    <li>Open Google Authenticator in your phone, and scan this QR code.</li>\n</ol>",
12   '5d412a3d8de0189df31c8f331e2e6630' :"<ol class='qr-list' start=\"2\">\n    <li>After adding this to Google Authenticator, type in the generated number below to confirm.</li>\n</ol>",
13   'ea4788705e6873b424c65e91c2846b19' :"Cancel",
14   'ee468f72ab7fe4937fb014d6fcea540b' :"Enter Two factor Authentication code",
15   'c9cc8cce247e49bae79f15173ce97354' :"Save",
16   '4674ee874911c910f2356ef9ec6ab7f9' :"Scan this into Google Authenticator"
17  },
18
19  dialog : false,
20  callback:  false,
21
22  show : function(data, cb)
23  {
24   if (!this.dialog) {
25    this.create();
26   }
27
28   this.callback = cb;
29   this.data = data;
30   this.dialog.show(this.data._el);
31   if (this.form) {
32    this.form.reset();
33    this.form.setValues(data);
34    this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
35   }
36
37  },
38
39  create : function()
40  {
41   var _this = this;
42   this.dialog = Roo.factory({
43     xtype : 'Modal',
44     allow_close : false,
45     cls : 'enable-overflow coba-qr-dialog',
46     title : _this._strings['4674ee874911c910f2356ef9ec6ab7f9'] /* Scan this into Google Authenticator */,
47     listeners : {
48      show : function (_self)
49       {
50           new Pman.Request({
51               url: baseURL + '/Roo/Core_person.php',
52               method : 'GET',
53               mask : 'Loading...',
54               params : {
55                   _to_qr_code : 1
56               },
57               
58               success : function(res) {
59                   
60                   _this.qrcode_image.setSrc(res.data);
61                   
62                   return;
63               }
64           });
65       }
66     },
67     xns : Roo.bootstrap,
68     '|xns' : 'Roo.bootstrap',
69     buttons : [
70      {
71       xtype : 'Button',
72       html : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
73       weight : 'default',
74       listeners : {
75        click : function (_self, e)
76         {
77             
78             _this.dialog.hide();
79             
80             //need to pass a flag
81             
82             if(_this.callback){
83                 _this.callback.call(_this);
84             }
85             
86             return;
87         }
88       },
89       xns : Roo.bootstrap,
90       '|xns' : 'Roo.bootstrap'
91      },
92      {
93       xtype : 'Button',
94       html : _this._strings['c9cc8cce247e49bae79f15173ce97354'] /* Save */,
95       weight : 'primary',
96       listeners : {
97        click : function (_self, e)
98         {
99             
100             _this.dialog.hide();
101             
102             if(_this.callback){
103                 _this.callback.call(_this);
104             }
105             
106             return;
107         }
108       },
109       xns : Roo.bootstrap,
110       '|xns' : 'Roo.bootstrap'
111      }
112     ],
113     items  : [
114      {
115       xtype : 'Row',
116       xns : Roo.bootstrap,
117       '|xns' : 'Roo.bootstrap',
118       items  : [
119        {
120         xtype : 'Column',
121         xs : 12,
122         xns : Roo.bootstrap,
123         '|xns' : 'Roo.bootstrap',
124         items  : [
125          {
126           xtype : 'Container',
127           html : _this._strings['dc7b0c7f9d3941532bda06cd58eec7bd'] /* 
128           <ol class='qr-list' start="1">          
129     <li>Open Google Authenticator in your phone, and scan this QR code.</li>          
130 </ol>
131           */ ,
132           well : 'sm',
133           xns : Roo.bootstrap,
134           '|xns' : 'Roo.bootstrap'
135          }
136         ]
137        }
138       ]
139      },
140      {
141       xtype : 'Row',
142       xns : Roo.bootstrap,
143       '|xns' : 'Roo.bootstrap',
144       items  : [
145        {
146         xtype : 'Column',
147         cls : 'text-center',
148         xs : 12,
149         xns : Roo.bootstrap,
150         '|xns' : 'Roo.bootstrap',
151         items  : [
152          {
153           xtype : 'Img',
154           cls : 'qr-code',
155           imgResponsive : false,
156           src : 'about:blank',
157           listeners : {
158            render : function (_self)
159             {
160                 _this.qrcode_image = this;
161                 
162                 this.el.setVisibilityMode(Roo.Element.DISPLAY);
163                 
164             }
165           },
166           xns : Roo.bootstrap,
167           '|xns' : 'Roo.bootstrap'
168          }
169         ]
170        }
171       ]
172      },
173      {
174       xtype : 'Row',
175       xns : Roo.bootstrap,
176       '|xns' : 'Roo.bootstrap',
177       items  : [
178        {
179         xtype : 'Column',
180         xs : 12,
181         xns : Roo.bootstrap,
182         '|xns' : 'Roo.bootstrap',
183         items  : [
184          {
185           xtype : 'Container',
186           html : _this._strings['5d412a3d8de0189df31c8f331e2e6630'] /* 
187           <ol class='qr-list' start="2">          
188     <li>After adding this to Google Authenticator, type in the generated number below to confirm.</li>          
189 </ol>
190           */ ,
191           well : 'sm',
192           xns : Roo.bootstrap,
193           '|xns' : 'Roo.bootstrap'
194          }
195         ]
196        }
197       ]
198      },
199      {
200       xtype : 'Row',
201       xns : Roo.bootstrap,
202       '|xns' : 'Roo.bootstrap',
203       items  : [
204        {
205         xtype : 'Column',
206         xs : 12,
207         xns : Roo.bootstrap,
208         '|xns' : 'Roo.bootstrap',
209         items  : [
210          {
211           xtype : 'Form',
212           listeners : {
213            actioncomplete : function (_self, action)
214             {
215                 if(action.type == 'setdata') {
216                     
217                     this.clearInvalid();
218                 }
219             },
220            render : function (_self)
221             {
222                 _this.form = this;
223             }
224           },
225           xns : Roo.bootstrap,
226           '|xns' : 'Roo.bootstrap',
227           items  : [
228            {
229             xtype : 'NumberField',
230             allowBlank : false,
231             allowDecimals : false,
232             allowNegative : false,
233             allowZero : false,
234             fieldLabel : _this._strings['ee468f72ab7fe4937fb014d6fcea540b'] /* Enter Two factor Authentication code */,
235             indicatorpos : 'right',
236             labelAlign : 'top',
237             xs : 12,
238             listeners : {
239              valid : function (_self)
240               {
241                   if(this.getValue().length() !== 6) {
242                       this.markInvalid('The authentication code should be in 6 digits');
243                   }
244               }
245             },
246             xns : Roo.bootstrap,
247             '|xns' : 'Roo.bootstrap'
248            }
249           ]
250          }
251         ]
252        }
253       ]
254      }
255     ]
256    }  );
257  }
258 });
259 Roo.apply(Pman.Dialog.BAdminStaffTwoFactorQRCode, Pman.Dialog.BAdminStaffTwoFactorQRCode.prototype);