From ea98bed16b11e1a7339b7647867d553e1ccaf537 Mon Sep 17 00:00:00 2001 From: Antoine Nguyen Date: Sat, 29 May 2021 09:57:35 +0200 Subject: [PATCH] Changes: * Updated parameter forms * Updated layout * Updated login page * Added 2FA authentication --- frontend/src/App.vue | 4 +- frontend/src/api/account.js | 4 + frontend/src/api/repository.js | 8 +- .../components/domains/DomainCreationForm.vue | 35 +++ .../components/domains/DomainOptionsForm.vue | 13 + .../identities/AccountCreationForm.vue | 38 ++- frontend/src/components/layout/Navbar.vue | 120 ++++---- .../src/components/logs/AuditTrailList.vue | 71 +++++ frontend/src/components/logs/LogList.vue | 72 ----- .../components/parameters/ParametersForm.vue | 111 ++++--- frontend/src/router/index.js | 56 +++- frontend/src/store/modules/domains.js | 9 +- frontend/src/views/Dashboard.vue | 7 + frontend/src/views/Login.vue | 105 ++++--- frontend/src/views/TwoFA.vue | 68 +++++ frontend/src/views/{ => domains}/Domain.vue | 2 +- .../src/views/{ => domains}/DomainEdit.vue | 0 frontend/src/views/{ => domains}/Domains.vue | 0 frontend/src/views/identities/Identities.vue | 6 + frontend/src/views/logs/AuditTrail.vue | 24 ++ modoboa/admin/api/v1/serializers.py | 2 +- modoboa/admin/api/v2/serializers.py | 55 +++- modoboa/admin/api/v2/viewsets.py | 2 +- modoboa/core/api/v2/serializers.py | 92 +++++- modoboa/core/api/v2/viewsets.py | 18 ++ modoboa/core/app_settings.py | 275 ++++++++++++++---- modoboa/core/constants.py | 2 + modoboa/core/drf_authentication.py | 46 +++ modoboa/parameters/tools.py | 20 +- 29 files changed, 936 insertions(+), 329 deletions(-) create mode 100644 frontend/src/components/logs/AuditTrailList.vue delete mode 100644 frontend/src/components/logs/LogList.vue create mode 100644 frontend/src/views/Dashboard.vue create mode 100644 frontend/src/views/TwoFA.vue rename frontend/src/views/{ => domains}/Domain.vue (97%) rename frontend/src/views/{ => domains}/DomainEdit.vue (100%) rename frontend/src/views/{ => domains}/Domains.vue (100%) create mode 100644 frontend/src/views/logs/AuditTrail.vue create mode 100644 modoboa/core/drf_authentication.py diff --git a/frontend/src/App.vue b/frontend/src/App.vue index ac93bd90a..3af13a0f5 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -1,9 +1,7 @@ @@ -80,6 +102,7 @@ export default { if (this.createAdmin) { result[3].items.push({ key: this.$gettext('Administrator name'), value: this.domain.domain_admin.username }) result[3].items.push({ + name: 'with_random_password', key: this.$gettext('Random password'), value: this.domain.domain_admin.with_random_password, type: 'yesno' @@ -117,6 +140,11 @@ export default { this.initDomain() }, methods: { + copyPassword () { + navigator.clipboard.writeText(this.domain.domain_admin.password).then(() => { + bus.$emit('notification', { msg: this.$gettext('Password copied to clipboard') }) + }) + }, initDomain () { this.domain = { name: '', @@ -154,6 +182,7 @@ export default { delete data.domain_admin } this.$store.dispatch('domains/createDomain', data).then(resp => { + this.$router.push({ name: 'DomainDetail', params: { id: resp.data.pk } }) bus.$emit('notification', { msg: this.$gettext('Domain created') }) this.close() }) @@ -161,3 +190,9 @@ export default { } } + + diff --git a/frontend/src/components/domains/DomainOptionsForm.vue b/frontend/src/components/domains/DomainOptionsForm.vue index fdc448edb..7129bd4fd 100644 --- a/frontend/src/components/domains/DomainOptionsForm.vue +++ b/frontend/src/components/domains/DomainOptionsForm.vue @@ -23,6 +23,7 @@ :label="'Random password' | translate" :disabled="!createAdmin" :hint="'Generate a random password for the administrator.' | translate" + @change="updatePassword" persistent-hint /> diff --git a/frontend/src/components/logs/LogList.vue b/frontend/src/components/logs/LogList.vue deleted file mode 100644 index 80e946fd4..000000000 --- a/frontend/src/components/logs/LogList.vue +++ /dev/null @@ -1,72 +0,0 @@ - - - diff --git a/frontend/src/components/parameters/ParametersForm.vue b/frontend/src/components/parameters/ParametersForm.vue index 465407196..6b7261e17 100644 --- a/frontend/src/components/parameters/ParametersForm.vue +++ b/frontend/src/components/parameters/ParametersForm.vue @@ -1,22 +1,28 @@