From e804aa655c8db2a40cfd05259fba3d53312adb33 Mon Sep 17 00:00:00 2001 From: ogerly Date: Tue, 8 Jun 2021 17:01:36 +0200 Subject: [PATCH 1/6] Feature: Cange Username --- frontend/src/apis/loginAPI.js | 6 ++- .../UserProfile/UserCard_FormUsername.vue | 37 +++++++++++++------ 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/frontend/src/apis/loginAPI.js b/frontend/src/apis/loginAPI.js index 91e92a2cc..3ba7b576a 100644 --- a/frontend/src/apis/loginAPI.js +++ b/frontend/src/apis/loginAPI.js @@ -120,12 +120,14 @@ const loginAPI = { } return apiPost(CONFIG.LOGIN_API_URL + 'updateUserInfos', payload) }, - changeUsernameProfile: async (sessionId, email, usernameNew) => { + changeUsernameProfile: async (sessionId, email, username) => { + console.log('changeUsernameProfile', username) + const payload = { session_id: sessionId, email, update: { - 'User.usernameNew': usernameNew, + 'User.username': username, }, } return apiPost(CONFIG.LOGIN_API_URL + 'updateUserInfos', payload) diff --git a/frontend/src/views/Pages/UserProfile/UserCard_FormUsername.vue b/frontend/src/views/Pages/UserProfile/UserCard_FormUsername.vue index b195f6ef6..7e6b67df6 100644 --- a/frontend/src/views/Pages/UserProfile/UserCard_FormUsername.vue +++ b/frontend/src/views/Pages/UserProfile/UserCard_FormUsername.vue @@ -3,11 +3,11 @@ - + {{ $t('form.username') }} {{ $t('form.change') }}
- + {{ $t('form.cancel') }} @@ -20,16 +20,16 @@ {{ $t('form.username') }} - @{{ $store.state.username }} + @{{ username }} - - - + + +
{{ $t('form.change_username_info') }}
- + {{ $t('form.save') }}
@@ -47,16 +47,29 @@ export default { name: 'FormUsername', data() { return { - edit_username: true, - username: '', + editUsername: true, + username: this.$store.state.username, + form: { + username: this.$store.state.username, + }, } }, + props: { + UserProfileTestData: { type: Object }, + }, methods: { async onSubmit() { - // console.log(this.data) - const result = await loginAPI.changeUsernameProfile(this.username) + console.log('onSubmit', this.form.username) + const result = await loginAPI.changeUsernameProfile( + this.$store.state.sessionId, + this.$store.state.email, + { + username: this.form.username, + }, + ) if (result.success) { - alert('changeUsername success') + this.$store.commit('username', this.form.username) + this.editUserdata = true } else { alert(result.result.message) } From a7009f935db0dcbfa10823a8836ba1469ef97510 Mon Sep 17 00:00:00 2001 From: ogerly Date: Tue, 8 Jun 2021 17:09:40 +0200 Subject: [PATCH 2/6] change api caall --- .../src/views/Pages/UserProfile/UserCard_FormUsername.vue | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/frontend/src/views/Pages/UserProfile/UserCard_FormUsername.vue b/frontend/src/views/Pages/UserProfile/UserCard_FormUsername.vue index 7e6b67df6..371d6a2e9 100644 --- a/frontend/src/views/Pages/UserProfile/UserCard_FormUsername.vue +++ b/frontend/src/views/Pages/UserProfile/UserCard_FormUsername.vue @@ -62,10 +62,8 @@ export default { console.log('onSubmit', this.form.username) const result = await loginAPI.changeUsernameProfile( this.$store.state.sessionId, - this.$store.state.email, - { - username: this.form.username, - }, + this.$store.state.email, + this.form.username, ) if (result.success) { this.$store.commit('username', this.form.username) From 519d5fec2f84624de5efa08c0b1d4707003f6a09 Mon Sep 17 00:00:00 2001 From: ogerly Date: Wed, 9 Jun 2021 10:21:58 +0200 Subject: [PATCH 3/6] username change and save --- frontend/src/apis/loginAPI.js | 2 - .../UserProfile/UserCard_FormUsername.vue | 62 ++++++++++++------- 2 files changed, 39 insertions(+), 25 deletions(-) diff --git a/frontend/src/apis/loginAPI.js b/frontend/src/apis/loginAPI.js index 3ba7b576a..2eeec754e 100644 --- a/frontend/src/apis/loginAPI.js +++ b/frontend/src/apis/loginAPI.js @@ -121,8 +121,6 @@ const loginAPI = { return apiPost(CONFIG.LOGIN_API_URL + 'updateUserInfos', payload) }, changeUsernameProfile: async (sessionId, email, username) => { - console.log('changeUsernameProfile', username) - const payload = { session_id: sessionId, email, diff --git a/frontend/src/views/Pages/UserProfile/UserCard_FormUsername.vue b/frontend/src/views/Pages/UserProfile/UserCard_FormUsername.vue index 371d6a2e9..445c69f8e 100644 --- a/frontend/src/views/Pages/UserProfile/UserCard_FormUsername.vue +++ b/frontend/src/views/Pages/UserProfile/UserCard_FormUsername.vue @@ -1,42 +1,58 @@ @@ -59,15 +75,15 @@ export default { }, methods: { async onSubmit() { - console.log('onSubmit', this.form.username) const result = await loginAPI.changeUsernameProfile( this.$store.state.sessionId, - this.$store.state.email, + this.$store.state.email, this.form.username, ) if (result.success) { this.$store.commit('username', this.form.username) - this.editUserdata = true + this.editUserdata = this.editUsername = !this.editUsername + alert('Dein Username wurde geändert.') } else { alert(result.result.message) } From 7ea10b0c5dd6ed36ec29c62c36c0e9cb9ba0efbd Mon Sep 17 00:00:00 2001 From: ogerly Date: Wed, 9 Jun 2021 10:55:55 +0200 Subject: [PATCH 4/6] change userdata css style --- .../UserProfile/UserCard_FormUserData.vue | 114 ++++++++++-------- 1 file changed, 64 insertions(+), 50 deletions(-) diff --git a/frontend/src/views/Pages/UserProfile/UserCard_FormUserData.vue b/frontend/src/views/Pages/UserProfile/UserCard_FormUserData.vue index a1f6a5919..79e8df37b 100644 --- a/frontend/src/views/Pages/UserProfile/UserCard_FormUserData.vue +++ b/frontend/src/views/Pages/UserProfile/UserCard_FormUserData.vue @@ -6,59 +6,72 @@ style="background-color: #ebebeba3 !important" > - - -
- {{ $t('form.edit') }} - - + + + + {{ $t('form.change') }} + + + + + + + + + + + {{ $t('form.firstname') }} + + + {{ form.firstName }} + + + + + + + + {{ $t('form.lastname') }} + + + {{ form.lastName }} + + + + + + + + {{ $t('form.description') }} + + + {{ form.description }} + + + -
- - - {{ $t('form.firstname') }} - - - {{ form.firstName }} - - - - - - - - {{ $t('form.lastname') }} - - - {{ form.lastName }} - - - - - - - - {{ $t('form.description') }} - - - {{ form.description }} - - - - - -
+ + +
+ + {{ $t('form.save') }} + +
+
+
@@ -98,6 +111,7 @@ export default { this.$store.commit('lastName', this.form.lastName) this.$store.commit('description', this.form.description) this.editUserdata = true + alert('Deine Daten wurden gespeichert und sind geändert.') } else { alert(result.result.message) } From a21e88ac94175d780d68378451f23b2b040e3a2a Mon Sep 17 00:00:00 2001 From: ogerly Date: Thu, 10 Jun 2021 15:53:27 +0200 Subject: [PATCH 5/6] fix profil page bugs --- .../src/views/Layout/DashboardLayout_gdd.vue | 37 ++-- .../UserProfile/UserCard_FormUserData.vue | 106 ++++++----- .../UserProfile/UserCard_FormUserPasswort.vue | 169 ++++++++++++------ .../UserProfile/UserCard_FormUsername.vue | 5 +- 4 files changed, 202 insertions(+), 115 deletions(-) diff --git a/frontend/src/views/Layout/DashboardLayout_gdd.vue b/frontend/src/views/Layout/DashboardLayout_gdd.vue index 70a35a40a..ce4d29768 100755 --- a/frontend/src/views/Layout/DashboardLayout_gdd.vue +++ b/frontend/src/views/Layout/DashboardLayout_gdd.vue @@ -2,24 +2,25 @@
diff --git a/frontend/src/views/Pages/UserProfile/UserCard_FormUserData.vue b/frontend/src/views/Pages/UserProfile/UserCard_FormUserData.vue index 79e8df37b..3bb1c48ae 100644 --- a/frontend/src/views/Pages/UserProfile/UserCard_FormUserData.vue +++ b/frontend/src/views/Pages/UserProfile/UserCard_FormUserData.vue @@ -12,7 +12,7 @@ v-if="editUserdata" @click="editUserdata = !editUserdata" class="pointer" - icon="gear-fill" + icon="pencil" > {{ $t('form.change') }} @@ -29,49 +29,57 @@ - - - {{ $t('form.firstname') }} - - - {{ form.firstName }} - - - - - - - - {{ $t('form.lastname') }} - - - {{ form.lastName }} - - - - - - - - {{ $t('form.description') }} - - - {{ form.description }} - - - - - + + + + {{ $t('form.firstname') }} + + + {{ form.firstName }} + + + + + + + + {{ $t('form.lastname') }} + + + {{ form.lastName }} + + + + + + + + {{ $t('form.description') }} + + + {{ form.description }} + + + + + - - -
- - {{ $t('form.save') }} - -
-
-
+ + +
+ + {{ $t('form.save') }} + +
+
+
+
@@ -93,9 +101,21 @@ export default { lastName: this.$store.state.lastName, description: this.$store.state.description, }, + loading: true, } }, methods: { + loadSubmitButton() { + if ( + this.form.firstName !== this.$store.state.firstName || + this.form.lastName !== this.$store.state.lastName || + this.form.description !== this.$store.state.description + ) { + this.loading = false + } else { + this.loading = true + } + }, async onSubmit() { const result = await loginAPI.updateUserInfos( this.$store.state.sessionId, diff --git a/frontend/src/views/Pages/UserProfile/UserCard_FormUserPasswort.vue b/frontend/src/views/Pages/UserProfile/UserCard_FormUserPasswort.vue index e1ade4ae0..6bc1d8942 100644 --- a/frontend/src/views/Pages/UserProfile/UserCard_FormUserPasswort.vue +++ b/frontend/src/views/Pages/UserProfile/UserCard_FormUserPasswort.vue @@ -1,62 +1,105 @@ @@ -71,10 +114,30 @@ export default { email: null, password: '', passwordNew: '', - passwordNew2: '', + passwordNewRepeat: '', + passwordVisibleOldPwd: false, + passwordVisibleNewPwd: false, + passwordVisibleNewPwdRepeat: false, + loading: true, } }, methods: { + togglePasswordVisibilityNewPwd() { + this.passwordVisibleNewPwd = !this.passwordVisibleNewPwd + }, + togglePasswordVisibilityNewPwdRepeat() { + this.passwordVisibleNewPwdRepeat = !this.passwordVisibleNewPwdRepeat + }, + togglePasswordVisibilityOldPwd() { + this.passwordVisibleOldPwd = !this.passwordVisibleOldPwd + }, + loadSubmitButton() { + if (this.passwordVisibleNewPwd === this.passwordVisibleNewPwdRepeat) { + this.loading = false + } else { + this.loading = true + } + }, async onSubmit() { // console.log(this.data) const result = await loginAPI.changePasswordProfile( diff --git a/frontend/src/views/Pages/UserProfile/UserCard_FormUsername.vue b/frontend/src/views/Pages/UserProfile/UserCard_FormUsername.vue index 445c69f8e..38738e54a 100644 --- a/frontend/src/views/Pages/UserProfile/UserCard_FormUsername.vue +++ b/frontend/src/views/Pages/UserProfile/UserCard_FormUsername.vue @@ -7,7 +7,7 @@ v-if="editUsername" @click="editUsername = !editUsername" class="pointer" - icon="gear-fill" + icon="pencil" > {{ $t('form.change') }} @@ -32,6 +32,9 @@ + + {{ $t('form.username') }} + From 0978b3e627d99871bb4ca9d0393c3f351275764b Mon Sep 17 00:00:00 2001 From: ogerly Date: Thu, 10 Jun 2021 17:45:23 +0200 Subject: [PATCH 6/6] fix lint --- .../src/views/Layout/DashboardLayout_gdd.vue | 38 +++++++++---------- .../UserProfile/UserCard_FormUserData.vue | 6 +-- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/frontend/src/views/Layout/DashboardLayout_gdd.vue b/frontend/src/views/Layout/DashboardLayout_gdd.vue index ce4d29768..564b4e430 100755 --- a/frontend/src/views/Layout/DashboardLayout_gdd.vue +++ b/frontend/src/views/Layout/DashboardLayout_gdd.vue @@ -2,25 +2,25 @@
diff --git a/frontend/src/views/Pages/UserProfile/UserCard_FormUserData.vue b/frontend/src/views/Pages/UserProfile/UserCard_FormUserData.vue index 3bb1c48ae..e07313c96 100644 --- a/frontend/src/views/Pages/UserProfile/UserCard_FormUserData.vue +++ b/frontend/src/views/Pages/UserProfile/UserCard_FormUserData.vue @@ -35,7 +35,7 @@ {{ $t('form.firstname') }} - {{ form.firstName }} + {{ $store.state.firstName }} @@ -46,7 +46,7 @@ {{ $t('form.lastname') }} - {{ form.lastName }} + {{ $store.state.lastName }} @@ -57,7 +57,7 @@ {{ $t('form.description') }} - {{ form.description }} + {{ $store.state.description }}