From b9e48f2102e3e4214f910e9f402bf977d0e04c77 Mon Sep 17 00:00:00 2001 From: joan Date: Tue, 11 Apr 2023 07:39:43 +0200 Subject: [PATCH] Added translations & enable through departments --- db/changes/231401/00-authCode.sql | 4 ++-- db/changes/231401/00-department.sql | 24 +++++++++++++++++++ db/changes/231401/00-user.sql | 3 +-- .../components/validate-email/index.html | 2 +- .../components/validate-email/locale/en.yml | 4 ---- .../components/validate-email/locale/es.yml | 12 ++++------ .../components/validate-email/style.scss | 2 +- print/templates/email/auth-code/locale/fr.yml | 5 ++++ print/templates/email/auth-code/locale/pt.yml | 5 ++++ 9 files changed, 43 insertions(+), 18 deletions(-) create mode 100644 db/changes/231401/00-department.sql delete mode 100644 front/salix/components/validate-email/locale/en.yml create mode 100644 print/templates/email/auth-code/locale/fr.yml create mode 100644 print/templates/email/auth-code/locale/pt.yml diff --git a/db/changes/231401/00-authCode.sql b/db/changes/231401/00-authCode.sql index 7f742d4aff..0415c90f05 100644 --- a/db/changes/231401/00-authCode.sql +++ b/db/changes/231401/00-authCode.sql @@ -8,7 +8,7 @@ create table `salix`.`authCode` constraint authCode_unique unique (code), constraint authCode_user_id_fk - foreign key (userFk) references account.user (id) + foreign key (userFk) references `account`.`user` (id) on update cascade on delete cascade ); @@ -22,6 +22,6 @@ create table `salix`.`userAccess` constraint userAccess_pk primary key (userFk), constraint userAccess_user_null_fk - foreign key (userFk) references account.user (id) + foreign key (userFk) references `account`.`user` (id) ) auto_increment = 0; \ No newline at end of file diff --git a/db/changes/231401/00-department.sql b/db/changes/231401/00-department.sql new file mode 100644 index 0000000000..ffc3a16229 --- /dev/null +++ b/db/changes/231401/00-department.sql @@ -0,0 +1,24 @@ +alter table `vn`.`department` + add `twoFactor` ENUM ('email') null comment 'Default user tow-factor auth type'; + +drop trigger `vn`.`department_afterUpdate`; + +DELIMITER $$ +$$ +create definer = root@localhost trigger department_afterUpdate + after update + on department + for each row +BEGIN + IF !(OLD.parentFk <=> NEW.parentFk) THEN + UPDATE vn.department_recalc SET isChanged = TRUE; + END IF; + + IF !(OLD.twoFactor <=> NEW.twoFactor) THEN + UPDATE account.user u + JOIN vn.workerDepartment wd ON wd.workerFk = u.id + SET u.twoFactor = NEW.twoFactor + WHERE wd.departmentFk = NEW.id; + END IF; +END;$$ +DELIMITER ; diff --git a/db/changes/231401/00-user.sql b/db/changes/231401/00-user.sql index 1427d04601..2a2a522c5b 100644 --- a/db/changes/231401/00-user.sql +++ b/db/changes/231401/00-user.sql @@ -1,3 +1,2 @@ alter table `account`.`user` - add `twoFactor` ENUM ('email') null comment 'Two factor auth type'; - + add `twoFactor` ENUM ('email') null comment 'Two-factor auth type'; \ No newline at end of file diff --git a/front/salix/components/validate-email/index.html b/front/salix/components/validate-email/index.html index e03cb9dcb4..3607e1a76c 100644 --- a/front/salix/components/validate-email/index.html +++ b/front/salix/components/validate-email/index.html @@ -1,5 +1,5 @@
Enter verification code
-Please enter the verification code that we have sent to your email address within 5 minutes. +Please enter the verification code that we have sent to your email address within 5 minutes