From c2b72b45d35ad62ff9723bdd1048621df464782a Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Mon, 23 Aug 2021 10:20:31 +0200 Subject: [PATCH 1/2] Fix deleting own account Signed-off-by: Thomas Citharel --- js/src/views/Settings/AccountSettings.vue | 33 ++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/js/src/views/Settings/AccountSettings.vue b/js/src/views/Settings/AccountSettings.vue index 8c1f222ca..317b24905 100644 --- a/js/src/views/Settings/AccountSettings.vue +++ b/js/src/views/Settings/AccountSettings.vue @@ -180,14 +180,29 @@ }}

- + + import { IAuthProvider } from "@/types/enums"; +import { GraphQLError } from "graphql/error/GraphQLError"; import { Component, Vue, Ref } from "vue-property-decorator"; import { Route } from "vue-router"; import { @@ -256,6 +272,8 @@ export default class AccountSettings extends Vue { changePasswordErrors: string[] = []; + deletePasswordErrors: string[] = []; + isDeleteAccountModalActive = false; passwordForAccountDeletion = ""; @@ -313,6 +331,8 @@ export default class AccountSettings extends Vue { async deleteAccount(): Promise { try { + this.deletePasswordErrors = []; + console.debug("Asking to delete account..."); await this.$apollo.mutate({ mutation: DELETE_ACCOUNT, variables: { @@ -321,7 +341,8 @@ export default class AccountSettings extends Vue { : null, }, }); - await logout(this.$apollo.provider.defaultClient); + console.debug("Deleted account, logging out client..."); + await logout(this.$apollo.provider.defaultClient, false); this.$buefy.notification.open({ message: this.$t( "Your account has been successfully deleted" @@ -333,7 +354,9 @@ export default class AccountSettings extends Vue { return await this.$router.push({ name: RouteName.HOME }); } catch (err) { - return this.handleErrors("delete", err); + this.deletePasswordErrors = err.graphQLErrors.map( + ({ message }: GraphQLError) => message + ); } } @@ -361,6 +384,10 @@ export default class AccountSettings extends Vue { ); } + get deleteAccountPasswordFieldType(): string | null { + return this.deletePasswordErrors.length > 0 ? "is-danger" : null; + } + private handleErrors(type: string, err: any) { console.error(err); From 3a79806c0f024efdd382fb91f0b5333ffa04eb83 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Mon, 23 Aug 2021 10:20:55 +0200 Subject: [PATCH 2/2] Accessibility improvements in AccountSettings Signed-off-by: Thomas Citharel --- js/src/variables.scss | 2 +- js/src/views/Settings/AccountSettings.vue | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/js/src/variables.scss b/js/src/variables.scss index 02942a8c1..f402b5bf8 100644 --- a/js/src/variables.scss +++ b/js/src/variables.scss @@ -54,7 +54,7 @@ $success-invert: findColorInvert($success); $info: #36bcd4; $info-invert: findColorInvert($info); $danger: #ff2e54; -$danger-invert: findColorInvert($danger); +$danger-invert: #000; $link: $primary; $link-invert: $primary-invert; $text: $violet-1; diff --git a/js/src/views/Settings/AccountSettings.vue b/js/src/views/Settings/AccountSettings.vue index 317b24905..9c5a9e03f 100644 --- a/js/src/views/Settings/AccountSettings.vue +++ b/js/src/views/Settings/AccountSettings.vue @@ -51,20 +51,22 @@ class="form" v-if="canChangeEmail" > - +

{{ $t("You'll receive a confirmation email.") }}

- + - + - + @@ -409,6 +413,12 @@ export default class AccountSettings extends Vue {