Login & order checkout user error logging improved, recover password translation fixes

This commit is contained in:
Juan Ferrer 2019-10-29 14:02:09 +01:00
parent 4d7d35cb84
commit e1ed50b139
23 changed files with 82 additions and 25 deletions

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
hedera-web (1.406.68) stable; urgency=low hedera-web (1.406.69) stable; urgency=low
* Initial Release. * Initial Release.

View File

@ -26,7 +26,9 @@ Please select an agency: Si us plau tria una agència
Please select a store: Si us plau tria un magatzem Please select a store: Si us plau tria un magatzem
NoAgeciesAvailableForDate: >- NoAgeciesAvailableForDate: >-
No hi ha agències disponibles per a la data i el consignatari seleccionats, No hi ha agències disponibles per a la data i el consignatari seleccionats,
modifica la data d'enviament de la comanda comprova la data de la comanda i que consignatari seleccionat conté una
província i codi postal correctes
NoWarehousesAvailableForDate: >- NoWarehousesAvailableForDate: >-
No hi ha magatzems disponibles per a la data seleccionada, modifica la data de No hi ha magatzems disponibles per a la data seleccionada, comprova la data
recollida de la comanda de recollida de la comanda i que consignatari seleccionat conté una província
i codi postal correctes

View File

@ -25,6 +25,9 @@ Please select an address: Please select an address
Please select an agency: Please select an agency Please select an agency: Please select an agency
Please select a store: Please select a store Please select a store: Please select a store
NoAgeciesAvailableForDate: >- NoAgeciesAvailableForDate: >-
No agencies available for the selected date and consignee, change the shipping There are no agencies available for the selected date and consignee, check
date of your order the date of the order and that selected address contains a correct province
NoWarehousesAvailableForDate: 'No stores available for the selected date, change the pickup date of you order' and zip code
NoWarehousesAvailableForDate: >-
There are no stores available for the selected date, check the date of order
pickup and that selected address contains a correct province and zip code

View File

@ -26,7 +26,9 @@ Please select an agency: Por favor elige una agencia
Please select a store: Por favor elige un almacén Please select a store: Por favor elige un almacén
NoAgeciesAvailableForDate: >- NoAgeciesAvailableForDate: >-
No hay agencias disponibles para la fecha y el consignatario seleccionados, No hay agencias disponibles para la fecha y el consignatario seleccionados,
modifica la fecha de envío del pedido comprueba la fecha del pedido y que consignatario seleccionado
contiene una provincia y código postal correctos
NoWarehousesAvailableForDate: >- NoWarehousesAvailableForDate: >-
No hay almacenes disponibles para la fecha seleccionada, modifica la fecha de No hay almacenes disponibles para la fecha seleccionada, comprueba la fecha
recogida del pedido de recogida del pedido y que consignatario seleccionado contiene una
provincia y código postal correctos

View File

@ -26,5 +26,9 @@ Please select an agency: Veuillez choisir une agence
Please select a store: Veuillez choisir un entrepôt Please select a store: Veuillez choisir un entrepôt
NoAgeciesAvailableForDate: >- NoAgeciesAvailableForDate: >-
Aucune agence disponibles pour la date et le destinataire sélectionné, changer Aucune agence disponibles pour la date et le destinataire sélectionné, changer
la date d'envoi de la commande la date d'envoi de la commande et vérifier quel destinataire a été sélectionné
NoWarehousesAvailableForDate: 'Pas de magasins disponibles à la date sélectionnée, changer la date de retrait' contient une province et un code postal correct
NoWarehousesAvailableForDate: >-
Pas de magasins disponibles à la date sélectionnée, changer la date de
retrait et vérifier quel destinataire a été sélectionné contient une province
et un code postal correct

View File

@ -26,7 +26,9 @@ Please select an agency: Por favor, escolha uma agência
Please select a store: Por favor, escolha um armazém Please select a store: Por favor, escolha um armazém
NoAgeciesAvailableForDate: >- NoAgeciesAvailableForDate: >-
Não há agências disponíveis para a data e o consignatario escolhido, modifique Não há agências disponíveis para a data e o consignatario escolhido, modifique
a data de envío do pedido a data de envío do pedido e verifique qual destinatário selecionou contém uma
província e código postal corretos
NoWarehousesAvailableForDate: >- NoWarehousesAvailableForDate: >-
Não há armazéns disponíveis para a data seleccionada, modifique a data para Não há armazéns disponíveis para a data seleccionada, modifique a data para
levantar a encomenda levantar a encomenda e verifique qual destinatário selecionou contém uma
província e código postal corretos

View File

@ -68,6 +68,10 @@ module.exports = new Class({
Htk.Toast.showError(_('Invalid login')); Htk.Toast.showError(_('Invalid login'));
this._logout(); this._logout();
break; break;
case 'UserDisabled':
Htk.Toast.showError(_('User disabled'));
this._logout();
break;
case 'SessionExpired': case 'SessionExpired':
Htk.Toast.showError(_('You\'ve been too idle')); Htk.Toast.showError(_('You\'ve been too idle'));
this._logout(); this._logout();

View File

@ -13,6 +13,9 @@ You've been too idle: Has estat massa temps inactiu i la sessió ha expirat
Invalid login: >- Invalid login: >-
Usuari o contrasenya incorrectes, recorda que s'hi distingeix entre majúscula Usuari o contrasenya incorrectes, recorda que s'hi distingeix entre majúscula
i minúscula i minúscula
User disabled: >-
L'autenticació és correcta però el compte d'usuari ha estat desactivada, si
us plau posa't en contacte amb el teu comercial o persona assignada
Please write your user name: Si us plau introdueix el teu nom d'usuari Please write your user name: Si us plau introdueix el teu nom d'usuari
A mail has been sent wich you can recover your password: T'hem enviat un correu on podràs recuperar la teva contrasenya A mail has been sent wich you can recover your password: T'hem enviat un correu on podràs recuperar la teva contrasenya
Menu: Menú Menu: Menú

View File

@ -11,6 +11,9 @@ Yet you are not a customer?: Yet you are not a customer?
Sign up: Sign up Sign up: Sign up
You've been too idle: You have been idle too long and your session has expired You've been too idle: You have been idle too long and your session has expired
Invalid login: 'Username or password incorrect, remember that it is case-sensitive' Invalid login: 'Username or password incorrect, remember that it is case-sensitive'
User disabled: >-
Authentication is correct but the user account has been disabled, please
contact your commercial or assigned person
Please write your user name: Please write your user name Please write your user name: Please write your user name
A mail has been sent wich you can recover your password: A mail has been sent wich you can recover your password A mail has been sent wich you can recover your password: A mail has been sent wich you can recover your password
Menu: Menu Menu: Menu

View File

@ -13,6 +13,9 @@ You've been too idle: Has estado demasiado tiempo inactivo y la sesión ha expir
Invalid login: >- Invalid login: >-
Usuario o contraseña incorrectos, recuerda que se hace distinción entre Usuario o contraseña incorrectos, recuerda que se hace distinción entre
mayúsculas y minúsculas mayúsculas y minúsculas
User disabled: >-
La autenticación es correcta pero la cuenta de usuario ha sido deshabilitada,
por favor ponte en contacto con tu comercial o persona asignada
Please write your user name: Por favor escribe tu nombre de usuario Please write your user name: Por favor escribe tu nombre de usuario
A mail has been sent wich you can recover your password: Te hemos enviado un correo donde podrás recuperar tu contraseña A mail has been sent wich you can recover your password: Te hemos enviado un correo donde podrás recuperar tu contraseña
Menu: Menú Menu: Menú

View File

@ -13,6 +13,9 @@ You've been too idle: Il a eu le temps de trop paresseux et votre session a expi
Invalid login: >- Invalid login: >-
Utilisateur ou mot de passe incorrect, n'oubliez pas de distinction entre Utilisateur ou mot de passe incorrect, n'oubliez pas de distinction entre
majuscules et minuscules majuscules et minuscules
User disabled: >-
Lauthentification est correcte mais le compte utilisateur a été désactivé.
Veuillez contacter votre représentant commercial ou votre correspondant.
Please write your user name: S'il vous plaît entrer votre nom d'utilisateur Please write your user name: S'il vous plaît entrer votre nom d'utilisateur
A mail has been sent wich you can recover your password: Nous avons envoyé un e-mail où vous pouvez récupérer votre mot de passe A mail has been sent wich you can recover your password: Nous avons envoyé un e-mail où vous pouvez récupérer votre mot de passe
Menu: Menu Menu: Menu

View File

@ -13,6 +13,9 @@ You've been too idle: 'Muito tempo de inatividade, a sessão foi finalizada'
Invalid login: >- Invalid login: >-
Usuário ou Palavra-Passe incorreto, lembre-se de diferenciar maiusculas e Usuário ou Palavra-Passe incorreto, lembre-se de diferenciar maiusculas e
minusculas minusculas
User disabled: >-
A autenticação está correta, mas a conta do usuário foi desativada. Entre em
contato com a pessoa comercial ou a quem foi designada.
Please write your user name: 'Por favor, escreva seu nome de usuário' Please write your user name: 'Por favor, escreva seu nome de usuário'
A mail has been sent wich you can recover your password: Um e-mail foi enviado para recuperar sua palavra-passe A mail has been sent wich you can recover your password: Um e-mail foi enviado para recuperar sua palavra-passe
Menu: Menú Menu: Menú

View File

@ -1,6 +1,6 @@
{ {
"name": "hedera-web", "name": "hedera-web",
"version": "1.406.68", "version": "1.406.69",
"description": "Verdnatura web page", "description": "Verdnatura web page",
"license": "GPL-3.0", "license": "GPL-3.0",
"repository": { "repository": {

View File

@ -0,0 +1,4 @@
{
"Recover password": "Recover password",
"Press on the following link to change your password.": "Press on the following link to change your password."
}

View File

@ -1,2 +0,0 @@
Recover password: Recover password
Press on the following link to change your password.: Press on the following link to change your password.

View File

@ -0,0 +1,4 @@
{
"Recover password": "Restaurar contraseña",
"Press on the following link to change your password.": "Pulsa en el siguiente link para cambiar tu contraseña."
}

View File

@ -1,2 +0,0 @@
Recover password: Restaurar contraseña
Press on the following link to change your password.: Presiona en el siguiente link para cambiar tu contraseña.

View File

@ -0,0 +1,4 @@
{
"Recover password": "Réinitialisation du mot de passe",
"Press on the following link to change your password.": "Appuyez sur le lien suivant pour changer votre mot de passe."
}

View File

@ -0,0 +1,4 @@
{
"Recover password": "Recuperar palavra-passe",
"Press on the following link to change your password.": "Pressione o botão para modificar sua palavra-passe."
}

View File

@ -1,2 +0,0 @@
Recover password: Recuperar palavra-passe
Press on the following link to change your password.: Pressione o botão para modificar sua palavra-passe.

View File

@ -4,7 +4,7 @@ include __DIR__.'/account.php';
class Login extends Vn\Web\JsonRequest { class Login extends Vn\Web\JsonRequest {
function run($db) { function run($db) {
if (!$_POST['user']) if (!$_POST['user'] || !$_POST['password'])
throw new Vn\Web\BadLoginException(); throw new Vn\Web\BadLoginException();
try { try {

View File

@ -21,6 +21,7 @@ class RecoverPassword extends Vn\Web\JsonRequest {
$report = new Vn\Web\Report($db, 'recover-password', ['url' => $url]); $report = new Vn\Web\Report($db, 'recover-password', ['url' => $url]);
$report->sendMail($user['email']); $report->sendMail($user['email']);
return \Vn\Lib\Locale::get();
return TRUE; return TRUE;
} }

View File

@ -21,6 +21,11 @@ class SessionExpiredException extends UserException {}
*/ */
class BadLoginException extends UserException {} class BadLoginException extends UserException {}
/**
* Thrown when user credentials are invalid.
*/
class UserDisabledException extends UserException {}
/** /**
* Thrown when client version is outdated. * Thrown when client version is outdated.
*/ */
@ -131,8 +136,7 @@ abstract class Service {
$user = strtolower($_POST['user']); $user = strtolower($_POST['user']);
$passwordHash = $db->getValue( $passwordHash = $db->getValue(
'SELECT bcryptPassword FROM account.user 'SELECT bcryptPassword FROM account.user WHERE `name` = #',
WHERE active AND `name` = #',
[$user] [$user]
); );
@ -190,6 +194,16 @@ abstract class Service {
} }
} }
if (!$anonymousUser) {
$isActive = $db->getValue(
'SELECT active FROM account.user WHERE `name` = #',
[$user]
);
if (!$isActive)
throw new UserDisabledException();
}
$db->query('CALL account.userLoginWithName(#)', [$user]); $db->query('CALL account.userLoginWithName(#)', [$user]);
$userChanged = !$anonymousUser $userChanged = !$anonymousUser