From f551a9047dd92f51272393b29ef20f0d570378e2 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Tue, 24 Sep 2019 18:47:35 +0200 Subject: [PATCH] Implement password change in basic user settings Signed-off-by: Thomas Citharel --- js/src/graphql/user.ts | 8 +++ js/src/router/user.ts | 8 +++ js/src/views/Account/MyAccount.vue | 17 +++++ js/src/views/User/PasswordChange.vue | 94 ++++++++++++++++++++++++++++ schema.graphql | 13 ++-- 5 files changed, 135 insertions(+), 5 deletions(-) create mode 100644 js/src/views/User/PasswordChange.vue diff --git a/js/src/graphql/user.ts b/js/src/graphql/user.ts index 61afe904d..c67fc5bbc 100644 --- a/js/src/graphql/user.ts +++ b/js/src/graphql/user.ts @@ -25,6 +25,14 @@ mutation ValidateUser($token: String!) { } `; +export const CHANGE_PASSWORD = gql` + mutation ChangePassword($oldPassword: String!, $newPassword: String!) { + changePassword(oldPassword: $oldPassword, newPassword: $newPassword) { + id + } + } +`; + export const CURRENT_USER_CLIENT = gql` query { currentUser @client { diff --git a/js/src/router/user.ts b/js/src/router/user.ts index 6d652a341..8580982d6 100644 --- a/js/src/router/user.ts +++ b/js/src/router/user.ts @@ -7,6 +7,7 @@ import SendPasswordReset from '@/views/User/SendPasswordReset.vue'; import PasswordReset from '@/views/User/PasswordReset.vue'; import { beforeRegisterGuard } from '@/router/guards/register-guard'; import { RouteConfig } from 'vue-router'; +import PasswordChange from '@/views/User/PasswordChange.vue'; export enum UserRouteName { REGISTER = 'Register', @@ -16,6 +17,7 @@ export enum UserRouteName { PASSWORD_RESET = 'PasswordReset', VALIDATE = 'Validate', LOGIN = 'Login', + PASSWORD_CHANGE = 'PasswordChange', } export const userRoutes: RouteConfig[] = [ @@ -70,4 +72,10 @@ export const userRoutes: RouteConfig[] = [ props: true, meta: { requiredAuth: false }, }, + { + path: '/my-account/password', + name: UserRouteName.PASSWORD_CHANGE, + component: PasswordChange, + meta: { requiredAuth: true }, + }, ]; diff --git a/js/src/views/Account/MyAccount.vue b/js/src/views/Account/MyAccount.vue index d09514e45..c1f6fde27 100644 --- a/js/src/views/Account/MyAccount.vue +++ b/js/src/views/Account/MyAccount.vue @@ -1,5 +1,10 @@