From 70d18b88bf5f52f41d7dda463ab41376bb14f3b4 Mon Sep 17 00:00:00 2001 From: wh1te909 Date: Thu, 20 Aug 2020 21:04:28 +0000 Subject: [PATCH] add email validation, hide password --- web/src/components/modals/admin/UserForm.vue | 47 +++++++++++++++---- .../modals/coresettings/EditCoreSettings.vue | 4 -- web/src/mixins/mixins.js | 8 +++- 3 files changed, 43 insertions(+), 16 deletions(-) diff --git a/web/src/components/modals/admin/UserForm.vue b/web/src/components/modals/admin/UserForm.vue index 27bba518..6581add4 100644 --- a/web/src/components/modals/admin/UserForm.vue +++ b/web/src/components/modals/admin/UserForm.vue @@ -9,19 +9,46 @@
Username:
- +
Password:
- + + +
Email:
- +
@@ -63,13 +90,14 @@ export default { email: "", first_name: "", last_name: "", - is_active: true + is_active: true, + isPwd: true, }; }, computed: { title() { return this.pk ? "Edit User" : "Add User"; - } + }, }, methods: { getUser() { @@ -94,7 +122,7 @@ export default { email: this.email, is_active: this.is_active, first_name: this.first_name, - last_name: this.last_name + last_name: this.last_name, }; if (this.pk) { @@ -110,8 +138,7 @@ export default { this.$q.notify(notifyErrorConfig(e.response.data)); }); } else { - - formData.password = this.password + formData.password = this.password; this.$store .dispatch("admin/addUser", formData) @@ -125,13 +152,13 @@ export default { this.$q.notify(notifyErrorConfig(e.response.data)); }); } - } + }, }, mounted() { // If pk prop is set that means we are editting if (this.pk) { this.getUser(); } - } + }, }; \ No newline at end of file diff --git a/web/src/components/modals/coresettings/EditCoreSettings.vue b/web/src/components/modals/coresettings/EditCoreSettings.vue index e7bc258d..5c4e4fde 100644 --- a/web/src/components/modals/coresettings/EditCoreSettings.vue +++ b/web/src/components/modals/coresettings/EditCoreSettings.vue @@ -240,10 +240,6 @@ export default { const removed = this.settings.email_alert_recipients.filter(k => k !== email); this.settings.email_alert_recipients = removed; }, - isValidEmail(val) { - const email = /^(?=[a-zA-Z0-9@._%+-]{6,254}$)[a-zA-Z0-9._%+-]{1,64}@(?:[a-zA-Z0-9-]{1,63}\.){1,8}[a-zA-Z]{2,63}$/; - return email.test(val); - }, editSettings() { this.$q.loading.show(); axios diff --git a/web/src/mixins/mixins.js b/web/src/mixins/mixins.js index d30c5428..e8f6ea6c 100644 --- a/web/src/mixins/mixins.js +++ b/web/src/mixins/mixins.js @@ -62,7 +62,7 @@ export default { return getTimeLapse(unixtime); }, alertTime(datetime) { - return getTimeLapse(Date.parse(datetime)/1000); + return getTimeLapse(Date.parse(datetime) / 1000); }, notifySuccess(msg, timeout = 2000) { @@ -76,6 +76,10 @@ export default { }, notifyInfo(msg, timeout = 2000) { Notify.create(notifyInfoConfig(msg, timeout)); - } + }, + isValidEmail(val) { + const email = /^(?=[a-zA-Z0-9@._%+-]{6,254}$)[a-zA-Z0-9._%+-]{1,64}@(?:[a-zA-Z0-9-]{1,63}\.){1,8}[a-zA-Z]{2,63}$/; + return email.test(val); + }, } };