Resetea contraseña solo con credenciales inválidas, errores solucionados

This commit is contained in:
Juan Ferrer Toribio 2017-10-06 12:36:46 +02:00
parent 7c7763eb0a
commit 1c6ca3ef62
1 changed files with 29 additions and 12 deletions

View File

@ -29,6 +29,8 @@ var Locale ={
"Error al actualizar"
,"Microsoft Access 2003 is not installed":
"Microsoft Access 2003 no está instalado en el sistema"
,"MDB file not found":
"No se encontro el fichero MDB"
}
};
@ -214,15 +216,17 @@ var App =
_onEnterClick: function ()
{
this._disableUi (true, _('Loading'));
setTimeout (function () {App.login();}, 0);
setTimeout (function () {App.login ();}, 0);
},
login: function ()
{
var user = this.$('user').value;
var password = this.$('password').value;
var clearPassword;
try {
var user = this.$('user').value;
var password = this.$('password').value;
if (!user || user === '')
throw new Error (_('Enter a user name'));
if (!password || password === '')
@ -250,6 +254,7 @@ var App =
switch (dbError.NativeError)
{
case 1045: // Access denied
clearPassword = true;
errorMsg = _('Bad login');
break;
case 2003: // Can't connect
@ -308,10 +313,7 @@ var App =
}
catch (e)
{
this.regWrite (Conf.dsPath, 'PWD', '', 'REG_SZ');
this._disableUi (false);
this.resetForm ();
this.showMessage (e.message);
this._catchError (e, clearPassword);
}
},
@ -346,18 +348,33 @@ var App =
alert (_('Error while updating') +': '+ e.message);
}
this._disableUi (false);
try {
if (this.fso.fileExists (this.mdbFile))
this.openMdb ();
if (!this.fso.fileExists (this.mdbFile))
throw new Error (_('MDB file not found'));
this.openMdb ();
}
catch (e)
{
this.showMessage (e.message);
this._catchError (e);
}
},
_catchError: function (error, clearPassword)
{
if (error)
{
if (!this.$('remember').checked || clearPassword)
this.regWrite (Conf.dsPath, 'PWD', '', 'REG_SZ');
this.showMessage (error.message);
}
this._disableUi (false);
this.$('user').focus ();
this.$('user').select ();
},
openMdb: function ()
{
var remember = this.$('remember').checked ? 1 : 0;