Roo.apply(Pman.Dialog.Login.prototype, {
_strings : {
- '6948c95faa7cc61ef0577ba729f95b03' :"Forgot Your Password ?",
'e50b62fb8271673bacc2cfd9d80fbe7a' :"Login to the Management Portal",
+ '99dea78007133396a7b8ed70578ac6ae' :"Login",
'cfcd208495d565ef66e7dff9f98764da' :"0",
+ 'cd4bcecae78474ea24c3f28350758a8c' :"Forgot your password ?",
'dc647eb65e6711e155375218212b3964' :"Password",
- '01a569ddc6cf67ddec2a683f0a5f5956' :"Forgot your password?",
'06cf692a8d2bb0ab8318dc6c839ae931' :"Two-Factor Authentication Number (if relevant)",
'11163ed17ad9afc7680bb9e92f15d6fd' :"We have sent you a link to reset your password",
- '5047040b025ce0295b58d42250014417' :"<div id=\"login-err\" class=\"dialog-err\" style=\"color:red\"></div>",
'24efa7ee4511563b16144f39706d594f' :"Notice",
'643a860f992333b8600ea264aca7c4fc' :"Email Address"
},
+ _named_strings : {
+ 'username_placeholder' : '643a860f992333b8600ea264aca7c4fc' /* Email Address */ ,
+ '_force_value' : 'cfcd208495d565ef66e7dff9f98764da' /* 0 */ ,
+ 'password_placeholder' : 'dc647eb65e6711e155375218212b3964' /* Password */ ,
+ 'oath_password_placeholder' : '06cf692a8d2bb0ab8318dc6c839ae931' /* Two-Factor Authentication Number (if relevant) */ ,
+ 'OK_html' : '99dea78007133396a7b8ed70578ac6ae' /* Login */
+ },
dialog : false,
callback: false,
xtype : 'Modal',
allow_close : false,
buttonPosition : 'center',
- buttons : Roo.bootstrap.Modal.OK,
- cls : 'enable-overflow login-dialog',
+ cls : 'enable-overflow login-dialog padding-bottom-trim',
_dialog_title_login : _this._strings['e50b62fb8271673bacc2cfd9d80fbe7a'] /* Login to the Management Portal */,
listeners : {
btnclick : function (e)
_this.dialog.hide();
return;
}
-
+ _this.alert.hide();
_this.dialog.el.select('.modal-content', true).first().mask('Sending...');
_this.form.doAction('submit');
},
render : function (_self) {
- Roo.get('login-err').dom.innerHTML = "";
+
_this.dialog.el.select('.modal-content', true).first().unmask();
if(Roo.isTouch){
},
show : function (_self)
{
-
-
this.setTitle( _this.dialog._dialog_title_login );
- if (!Roo.state.Manager.getProvider().expires) {
- Roo.state.Manager.setProvider(new Roo.state.CookieProvider());
- }
-
- _this.lastLogin = Roo.state.Manager.get('Pman.Login', {});
- _this.form.findField('username').focus();
-
-
+
}
},
xns : Roo.bootstrap,
buttons : [
{
xtype : 'Button',
+ html : _this._strings['99dea78007133396a7b8ed70578ac6ae'] /* Login */,
+ name : 'OK',
+ style : 'float: right',
+ weight : 'primary',
+ xns : Roo.bootstrap,
+ '|xns' : 'Roo.bootstrap'
+ },
+ {
+ xtype : 'Button',
+ cls : 'login-forgot-pass-btn',
+ _forgot_passwd_success_body : _this._strings['11163ed17ad9afc7680bb9e92f15d6fd'] /* We have sent you a link to reset your password */,
+ _forgot_passwd_success_title : _this._strings['24efa7ee4511563b16144f39706d594f'] /* Notice */,
href : '#',
- html : _this._strings['6948c95faa7cc61ef0577ba729f95b03'] /* Forgot Your Password ? */,
- preventDefault : true,
+ html : _this._strings['cd4bcecae78474ea24c3f28350758a8c'] /* Forgot your password ? */,
removeClass : true,
+ style : 'float: left',
tag : 'a',
weight : 'link',
listeners : {
- click : function (_self, e)
- {
+ click : function () {
+
_this.dialog.hide();
- Coba.Dialog.ForgotPassword.show({
- username : _this.form.findField('username').getValue()
- }, function(){
- Roo.bootstrap.MessageBox.alert('Notice', 'We have sent you a link to reset your password');
- return;
+ var email = _this.form.findField('username').getValue();
+
+ var _self = this;
+
+ Pman.Dialog.BAdminForgotPassword.show({email : email}, function(){
+ Roo.bootstrap.MessageBox.alert(_self._forgot_passwd_success_title, _self._forgot_passwd_success_body, function() {
+ _this.dialog.show();
+ });
+
});
}
},
items : [
{
xtype : 'Row',
- style : 'margin-top:20px;',
xns : Roo.bootstrap,
'|xns' : 'Roo.bootstrap',
items : [
url : baseURL + '/Login',
listeners : {
actioncomplete : function (_self, action) {
+
+
+ if (!Roo.state.Manager.getProvider().expires) {
+ Roo.state.Manager.setProvider(new Roo.state.CookieProvider());
+ }
+
+ _this.lastLogin = Roo.state.Manager.get('Pman.Login', {});
+ _this.form.findField('username').focus();
+
if(action.type == 'setdata'){
+ this.findField('username').show();
+ this.findField('password').show();
+ this.findField('oath_password').hide();
+
+
+ _this.errorRow.hide();
+ _this.dialog.el.select('.modal-content', true).first().unmask();
+ this.clearInvalid();
if(
_this.lastLogin &&
- _this.lastLogin.login_provider == ''
+ _this.lastLogin.username != ''
){
- _this.form.findField('username').setValue(_this.lastLogin.email);
+
+ _this.form.findField('username').setValue(_this.lastLogin.username);
+ _this.form.findField('password').focus();
}
-
- Roo.get('login-err').dom.innerHTML = "";
- _this.dialog.el.select('.modal-content', true).first().unmask();
- this.clearInvalid();
return;
}
}
if (action.type =='submit') {
-
+
_this.dialog.hide();
-
- if (_this.callback) {
- _this.callback.call(_this, action.result);
- }
-
- _this.form.reset();
-
- return;
+
+ var cb = function(){
+ if (_this.callback) {
+ _this.callback.call(_this, action.result);
+ }
+
+ _this.form.reset();
+
+ return;
+ }
+
+ if(
+ !action.result.data.oath_key_enable &&
+ action.result.data.require_oath * 1 == 1
+ ) {
+ Roo.bootstrap.MessageBox.show({
+ title : "Two Factor Authentication is required",
+ closable : false,
+ msg : "This system requires that you use Google Two Factor Authentication.",
+ buttons : {yes:'Setup Two Factor Authentication'},
+ fn : function(ret){
+ if(ret != 'yes'){
+ return;
+ }
+
+ Pman.Dialog.BAdminStaffTwoFactorQRCode.show(
+ {id: action.result.data.id, allow_close : true },
+ cb
+ );
+ }
+ });
+
+ return;
+ }
+ // store only username
+ Roo.state.Manager.set('Pman.Login', {
+ username : this.findField('username').getValue()
+ });
+ cb();
}
},
actionfailed : function (_self, action) {
Roo.log(action);
_this.dialog.el.select('.modal-content', true).first().unmask();
-
+ _this.alert.show();
if (typeof(action) != 'undefined' && action.failureType == 'server') {
-
- if(action.result.errorMsg == 'Authenticated'){
- var data = Roo.apply(action.result.errors);
-
- data.target = _this.form.findField('username').getValue();
-
- Roo.bootstrap.MessageBox.alert("Error", "odd error messages")
-
+
+ switch (action.result.code) {
+
+ case 'Authenticated' :
+
+
+ Roo.bootstrap.MessageBox.alert("Error",action.result.errorMsg);
+ _this.alert.setHtml(action.result.errorMsg);
+ break;
+
+ case 'NEW-IP-ADDRESS' :
+ case 'PENDING-IP-ADDRESS' :
+ case 'BAD-IP-ADDRESS' :
+ case 'BLOCKED-IP-ADDRESS' :
+
+ _this.dialog.hide();
+ Roo.bootstrap.MessageBox.alert("Error", action.result.errorMsg);
+ //Pman.Dialog.LoginNotice.show({
+ // status : action.result.errorMsg,
+ // ip : action.result.errors.ip
+ //});
+
+ break;
+ case 'LOGIN-2FA':
+ this.findField('username').hide();
+ this.findField('password').hide();
+ this.findField('oath_password').show();
+ return; // no way back from here..
+
+ default:
+ _this.errorRow.show();
+ _this.alert.setHtml(action.result.errorMsg);
+ break;
}
- Roo.get('login-err').dom.innerHTML = action.result.errorMsg;
return;
}
- Roo.get('login-err').dom.innerHTML = "Fill in all the required fields";
+ _this.alert.setHtml( "Fill in all the required fields");
},
render : function (_self) {
_this.form = _self;
'|xns' : 'Roo.bootstrap'
},
{
- xtype : 'Input',
+ xtype : 'NumberField',
allowBlank : true,
- inputType : 'number',
+ allowDecimals : false,
+ allowNegative : false,
+ allowZero : true,
+ decimalPrecision : 0,
+ hidden : true,
+ maxLength : 6,
name : 'oath_password',
placeholder : _this._strings['06cf692a8d2bb0ab8318dc6c839ae931'] /* Two-Factor Authentication Number (if relevant) */,
listeners : {
},
{
xtype : 'Row',
- style : 'margin-top: 20px;',
+ listeners : {
+ render : function (_self)
+ {
+ _this.errorRow = this;
+ }
+ },
xns : Roo.bootstrap,
'|xns' : 'Roo.bootstrap',
items : [
{
- xtype : 'Column',
- xs : 6,
+ xtype : 'Container',
+ cls : 'col-md-12',
xns : Roo.bootstrap,
'|xns' : 'Roo.bootstrap',
items : [
{
- xtype : 'Button',
- _forgot_passwd_success_body : _this._strings['11163ed17ad9afc7680bb9e92f15d6fd'] /* We have sent you a link to reset your password */,
- _forgot_passwd_success_title : _this._strings['24efa7ee4511563b16144f39706d594f'] /* Notice */,
- href : '#',
- html : _this._strings['01a569ddc6cf67ddec2a683f0a5f5956'] /* Forgot your password? */,
- removeClass : true,
- tag : 'a',
- weight : 'link',
+ xtype : 'Alert',
+ weight : 'danger',
listeners : {
- click : function () {
-
- _this.dialog.hide();
-
- var email = _this.form.findField('username').getValue();
-
- var _self = this;
-
- Pman.Dialog.BAdminForgotPassword.show({email : email}, function(){
- Roo.bootstrap.MessageBox.alert(_self._forgot_passwd_success_title, _self._forgot_passwd_success_body);
- });
+ render : function (_self)
+ {
+ _this.alert = this;
}
},
xns : Roo.bootstrap,
]
}
]
- },
- {
- xtype : 'Row',
- xns : Roo.bootstrap,
- '|xns' : 'Roo.bootstrap',
- items : [
- {
- xtype : 'Container',
- cls : 'col-md-12',
- xns : Roo.bootstrap,
- '|xns' : 'Roo.bootstrap',
- items : [
- {
- xtype : 'Container',
- cls : 'bg-danger',
- html : _this._strings['5047040b025ce0295b58d42250014417'] /* <div id="login-err" class="dialog-err" style="color:red"></div> */,
- style : 'margin-top:20px;',
- xns : Roo.bootstrap,
- '|xns' : 'Roo.bootstrap'
- }
- ]
- }
- ]
}
]
}
]
- },
- {
- xtype : 'Button',
- _forgot_passwd_success_body : _this._strings['11163ed17ad9afc7680bb9e92f15d6fd'] /* We have sent you a link to reset your password */,
- _forgot_passwd_success_title : _this._strings['24efa7ee4511563b16144f39706d594f'] /* Notice */,
- href : '#',
- html : _this._strings['01a569ddc6cf67ddec2a683f0a5f5956'] /* Forgot your password? */,
- removeClass : true,
- tag : 'a',
- weight : 'link',
- listeners : {
- click : function () {
-
- _this.dialog.hide();
-
- var email = _this.form.findField('username').getValue();
-
- var _self = this;
-
- Pman.Dialog.BAdminForgotPassword.show({email : email}, function(){
- Roo.bootstrap.MessageBox.alert(_self._forgot_passwd_success_title, _self._forgot_passwd_success_body);
- });
- }
- },
- xns : Roo.bootstrap,
- '|xns' : 'Roo.bootstrap'
}
]
} );