1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
5 Roo.namespace('Pman.Dialog');
7 Pman.Dialog.BAdminStaffTwoFactorQRCode= function() {}
8 Roo.apply(Pman.Dialog.BAdminStaffTwoFactorQRCode.prototype, {
11 '1459eb538ddc78e1908bbd761a444395' :"1. Download an Authentication App on your phone, like \"<a href='#' class='download-google-authenticator' style='color:#337ab7;'>Google Authenticator</a>\" or \"<a href='#' class='download-authy' style='color:#337ab7;'>Authy</a>\" ",
12 'e8e9a5b1083b253b726d1fa7f31176f5' :"2. After adding this to Authenticator app, type in the generated number below to confirm.",
13 '2194867d6c27ce97cd1f0a5db8d5c95e' :"Setup 2-Factor Authentication",
14 '22e960368d2513a40b7467ec143440cc' :"5. After adding this to Authenticator app, type in the generated number below to confirm.",
15 '131e3875e777f6c9a8e510f96a4d20d2' :"Skip for now",
16 'f93dadd0b45b370c51bf80fb0a3eadfa' :"3. For the Account Name user \"{0}\"",
17 '8e5b55264e2acf73fb73b6a327bccd51' :"4. Enter the code below as \"Your Key\"",
18 '4141195b21d661e36e56d91f19d53273' :"2. In the App, select \"<b>Create or Setup an Account</b>\"",
19 'ea4788705e6873b424c65e91c2846b19' :"Cancel",
20 'ee468f72ab7fe4937fb014d6fcea540b' :"Enter Two factor Authentication code",
21 '6d9785b18748c30bb3adbf7506f40202' :"1. Open Authenticator App in your phone, and scan this QR code.",
22 '780573538d031cf7387477f9ea3204f6' :"Copy Key",
23 '70d9be9b139893aa6c69b5e77e614311' :"Confirm"
26 'two_factor_auth_code_fieldLabel' : 'ee468f72ab7fe4937fb014d6fcea540b' /* Enter Two factor Authentication code */
32 show : function(data, cb)
40 this.dialog.show(this.data._el);
43 this.form.setValues(data);
44 this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });
52 this.dialog = Roo.factory({
56 cls : 'enable-overflow coba-qr-dialog',
57 title : _this._strings['2194867d6c27ce97cd1f0a5db8d5c95e'] /* Setup 2-Factor Authentication */,
59 hide : function (_self)
62 _this.callback.call(_this, false);
66 show : function (_self)
68 if(!Pman.Login.authUser) {
69 Roo.bootstrap.MessageBox.alert('Error', 'Please login again');
75 _this.data.id.length == 0
77 Roo.bootstrap.MessageBox.alert('Error', 'Please select a person again');
81 _this.dialog.closeEl.hide();
83 _this.cancelBtn.hide();
85 if(_this.data.allow_close) {
86 _this.dialog.closeEl.show();
90 if(_this.data.allow_cancel) {
91 _this.cancelBtn.show();
94 _this.desktopView.hide();
95 _this.mobileView.hide();
98 url: baseURL + '/Roo/Core_person.php',
106 success : function(res) {
107 _this.qrcode_image.setSrc(res.data.image);
108 _this.secret.setValue(res.data.secret);
109 _this.issuer_notify.el.dom.innerHTML = String.format(_this.issuer_notify._html, res.data.issuer);
111 _this.desktopView.show();
112 _this.mobileView.hide();
115 _this.desktopView.hide();
116 _this.mobileView.show();
120 failure : function(res) {
127 '|xns' : 'Roo.bootstrap',
131 html : _this._strings['131e3875e777f6c9a8e510f96a4d20d2'] /* Skip for now */,
134 click : function (_self, e)
140 render : function (_self)
142 _this.skipBtn = this;
146 '|xns' : 'Roo.bootstrap'
150 html : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */,
153 click : function (_self, e)
159 render : function (_self)
161 _this.cancelBtn = this;
165 '|xns' : 'Roo.bootstrap'
169 html : _this._strings['70d9be9b139893aa6c69b5e77e614311'] /* Confirm */,
172 click : function (_self, e)
174 _this.form.doAction('submit');
178 '|xns' : 'Roo.bootstrap'
185 render : function (_self)
187 _this.desktopView = this;
191 '|xns' : 'Roo.bootstrap',
197 '|xns' : 'Roo.bootstrap',
202 '|xns' : 'Roo.bootstrap',
208 '|xns' : 'Roo.bootstrap',
212 html : _this._strings['6d9785b18748c30bb3adbf7506f40202'] /* 1. Open Authenticator App in your phone, and scan this QR code. */,
215 '|xns' : 'Roo.bootstrap'
224 '|xns' : 'Roo.bootstrap',
231 '|xns' : 'Roo.bootstrap',
236 imgResponsive : false,
239 render : function (_self)
241 _this.qrcode_image = this;
243 this.el.setVisibilityMode(Roo.Element.DISPLAY);
248 '|xns' : 'Roo.bootstrap'
257 '|xns' : 'Roo.bootstrap',
263 '|xns' : 'Roo.bootstrap',
267 html : _this._strings['e8e9a5b1083b253b726d1fa7f31176f5'] /* 2. After adding this to Authenticator app, type in the generated number below to confirm. */,
270 '|xns' : 'Roo.bootstrap'
283 render : function (_self)
285 _this.mobileView = this;
289 '|xns' : 'Roo.bootstrap',
295 '|xns' : 'Roo.bootstrap',
300 '|xns' : 'Roo.bootstrap',
306 '|xns' : 'Roo.bootstrap',
310 html : _this._strings['1459eb538ddc78e1908bbd761a444395'] /* 1. Download an Authentication App on your phone, like "<a href='#' class='download-google-authenticator' style='color:#337ab7;'>Google Authenticator</a>" or "<a href='#' class='download-authy' style='color:#337ab7;'>Authy</a>" */,
313 render : function (_self)
315 this.el.select('.download-google-authenticator', true).first().on('click', function(e){
319 window.open("https://itunes.apple.com/us/app/google-authenticator/id388497605?mt=8", "_blank");
323 window.open("https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2", "_blank");
326 this.el.select('.download-authy', true).first().on('click', function(e){
330 window.open("https://itunes.apple.com/us/app/authy/id494168017?mt=8", "_blank");
334 window.open("https://play.google.com/store/apps/details?id=com.ionicpremium.authy", "_blank");
339 '|xns' : 'Roo.bootstrap'
348 '|xns' : 'Roo.bootstrap',
354 '|xns' : 'Roo.bootstrap',
358 html : _this._strings['4141195b21d661e36e56d91f19d53273'] /* 2. In the App, select "<b>Create or Setup an Account</b>" */,
361 '|xns' : 'Roo.bootstrap'
370 '|xns' : 'Roo.bootstrap',
376 '|xns' : 'Roo.bootstrap',
380 _html : _this._strings['f93dadd0b45b370c51bf80fb0a3eadfa'] /* 3. For the Account Name user "{0}" */,
381 html : _this._strings['f93dadd0b45b370c51bf80fb0a3eadfa'] /* 3. For the Account Name user "{0}" */,
384 render : function (_self)
386 _this.issuer_notify = this;
390 '|xns' : 'Roo.bootstrap'
399 '|xns' : 'Roo.bootstrap',
405 '|xns' : 'Roo.bootstrap',
409 html : _this._strings['8e5b55264e2acf73fb73b6a327bccd51'] /* 4. Enter the code below as "Your Key" */,
412 '|xns' : 'Roo.bootstrap'
421 '|xns' : 'Roo.bootstrap',
427 '|xns' : 'Roo.bootstrap',
434 render : function (_self)
440 '|xns' : 'Roo.bootstrap'
449 '|xns' : 'Roo.bootstrap',
453 html : _this._strings['780573538d031cf7387477f9ea3204f6'] /* Copy Key */,
454 preventDefault : true,
456 style : 'margin-bottom: 15px;',
458 click : function (_self, e)
460 var el = _this.secret.inputEl().dom;
462 if (document.body.createTextRange) {
464 var textRange = document.body.createTextRange();
465 textRange.moveToElementText(el);
467 textRange.execCommand("Copy");
468 } else if (window.getSelection && document.createRange) {
470 var editable = el.contentEditable; // Record contentEditable status of element
471 var readOnly = el.readOnly; // Record readOnly status of element
472 el.contentEditable = true; // iOS will only select text on non-form elements if contentEditable = true;
473 el.readOnly = false; // iOS will not select in a read only form element
474 var range = document.createRange();
475 range.selectNodeContents(el);
476 var sel = window.getSelection();
477 sel.removeAllRanges();
478 sel.addRange(range); // Does not work for Firefox if a textarea or input
480 if (el.nodeName == "TEXTAREA" || el.nodeName == "INPUT") {
481 el.select(); // Firefox will only select a form element with select()
484 if (el.setSelectionRange && navigator.userAgent.match(/ipad|ipod|iphone/i)) {
485 el.setSelectionRange(0, 999999); // iOS only selects "form" elements with SelectionRange
488 el.contentEditable = editable; // Restore previous contentEditable status
489 el.readOnly = readOnly; // Restore previous readOnly status
491 document.execCommand('copy');
496 '|xns' : 'Roo.bootstrap'
505 '|xns' : 'Roo.bootstrap',
511 '|xns' : 'Roo.bootstrap',
515 html : _this._strings['22e960368d2513a40b7467ec143440cc'] /* 5. After adding this to Authenticator app, type in the generated number below to confirm. */,
518 '|xns' : 'Roo.bootstrap'
531 '|xns' : 'Roo.bootstrap',
537 '|xns' : 'Roo.bootstrap',
542 url : baseURL + '/Roo/Core_person.php',
544 actioncomplete : function (_self, action)
546 if(action.type == 'setdata') {
551 if(action.type == 'submit') {
553 switch(action.result.data) {
556 var cb = function() {
560 Roo.bootstrap.MessageBox.alert('Success', 'Two Factor authentication has been enabled', cb);
564 Roo.log('invalid usage');
569 actionfailed : function (_self, action)
571 if(action.type == 'submit') {
573 switch(action.result.errorMsg) {
574 case '_invalid_auth_code':
575 Roo.bootstrap.MessageBox.alert(
576 'Invalid authentication code',
577 'Please re-enter the latest authentication code.'
581 Roo.log('invalid usage');
586 render : function (_self)
592 '|xns' : 'Roo.bootstrap',
595 xtype : 'NumberField',
597 allowDecimals : false,
598 allowNegative : false,
600 decimalPrecision : 0,
601 fieldLabel : _this._strings['ee468f72ab7fe4937fb014d6fcea540b'] /* Enter Two factor Authentication code */,
602 indicatorpos : 'right',
605 name : 'two_factor_auth_code',
608 '|xns' : 'Roo.bootstrap'
612 inputType : 'hidden',
615 '|xns' : 'Roo.bootstrap'
627 Roo.apply(Pman.Dialog.BAdminStaffTwoFactorQRCode, Pman.Dialog.BAdminStaffTwoFactorQRCode.prototype);