From 797855d9dfe33bdb735091c1c9edd0d9079a37db Mon Sep 17 00:00:00 2001 From: Pranav C Balan Date: Sun, 13 Jun 2021 20:25:31 +0530 Subject: [PATCH] fix(gui): Email validation fix #267 Signed-off-by: Pranav C Balan --- .../nc-gui/components/auth/userManagement.vue | 3 +- packages/nc-gui/helpers/index.js | 24 +++++++++++ .../pages/user/authentication/signin.vue | 43 +++++++++++-------- .../user/authentication/signup/index.vue | 5 ++- 4 files changed, 53 insertions(+), 22 deletions(-) create mode 100644 packages/nc-gui/helpers/index.js diff --git a/packages/nc-gui/components/auth/userManagement.vue b/packages/nc-gui/components/auth/userManagement.vue index da1ba72d47..ed7630c549 100644 --- a/packages/nc-gui/components/auth/userManagement.vue +++ b/packages/nc-gui/components/auth/userManagement.vue @@ -453,6 +453,7 @@ import SetListCheckboxCell from "@/components/project/spreadsheet/editableCell/setListCheckboxCell"; import {enumColor as colors, enumColor} from "@/components/project/spreadsheet/helpers/colors"; import DlgLabelSubmitCancel from "@/components/utils/dlgLabelSubmitCancel"; +import {isEmail} from "@/helpers"; export default { name: "user-management", @@ -475,7 +476,7 @@ export default { valid: null, emailRules: [ v => !!v || 'E-mail is required', - v => /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test(v) || 'E-mail must be valid' + v => isEmail(v) || 'E-mail must be valid' ], userList: [] }), diff --git a/packages/nc-gui/helpers/index.js b/packages/nc-gui/helpers/index.js new file mode 100644 index 0000000000..a58c35248a --- /dev/null +++ b/packages/nc-gui/helpers/index.js @@ -0,0 +1,24 @@ +export const isEmail = v => /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test(v) + +/** + * @copyright Copyright (c) 2021, Xgene Cloud Ltd + * + * @author Naveen MR + * @author Pranav C Balan + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ diff --git a/packages/nc-gui/pages/user/authentication/signin.vue b/packages/nc-gui/pages/user/authentication/signin.vue index 53d639f9e5..9a8d8e3dd1 100644 --- a/packages/nc-gui/pages/user/authentication/signin.vue +++ b/packages/nc-gui/pages/user/authentication/signin.vue @@ -63,8 +63,9 @@

{{ - $t('signin.forget_password') - }} + $t('signin.forget_password') + }} +

@@ -87,9 +88,9 @@ Sign In -
-
-
+
+
+

{{ $t('signin.footer_text_1') }} @@ -199,7 +200,7 @@