setPassword in frontend

remove resetPassword
This commit is contained in:
Ulf Gebhardt 2021-11-23 12:08:23 +01:00
parent d1dfda81ce
commit d5b2356caf
Signed by: ulfgebhardt
GPG Key ID: DA6B843E748679C9
3 changed files with 7 additions and 44 deletions

View File

@ -470,23 +470,6 @@ export class UserResolver {
return true
}
@Mutation(() => String)
async resetPassword(
@Args()
{ sessionId, email, password }: ChangePasswordArgs,
): Promise<string> {
const payload = {
session_id: sessionId,
email,
password,
}
const result = await apiPost(CONFIG.LOGIN_API_URL + 'resetPassword', payload)
if (!result.success) {
throw new Error(result.data)
}
return 'success'
}
@Query(() => Boolean)
async setPassword(
@Arg('code') code: string,

View File

@ -12,9 +12,9 @@ export const unsubscribeNewsletter = gql`
}
`
export const resetPassword = gql`
mutation($sessionId: Float!, $email: String!, $password: String!) {
resetPassword(sessionId: $sessionId, email: $email, password: $password)
export const setPassword = gql`
mutation($code: String!, $password: String!) {
setPassword(code: $code, password: $password)
}
`

View File

@ -49,7 +49,7 @@
<script>
import InputPasswordConfirmation from '../../components/Inputs/InputPasswordConfirmation'
import { loginViaEmailVerificationCode } from '../../graphql/queries'
import { resetPassword } from '../../graphql/mutations'
import { setPassword } from '../../graphql/mutations'
export default {
name: 'ResetPassword',
@ -73,10 +73,9 @@ export default {
async onSubmit() {
this.$apollo
.mutate({
mutation: resetPassword,
mutation: setPassword,
variables: {
sessionId: this.sessionId,
email: this.email,
code: this.$route.params.optin,
password: this.form.password,
},
})
@ -89,27 +88,8 @@ export default {
})
},
async authenticate() {
const loader = this.$loading.show({
container: this.$refs.header,
})
// TODO validate somehow if present and looks good?
const optin = this.$route.params.optin
this.$apollo
.query({
query: loginViaEmailVerificationCode,
variables: {
optin: optin,
},
})
.then((result) => {
this.authenticated = true
this.sessionId = result.data.loginViaEmailVerificationCode.sessionId
this.email = result.data.loginViaEmailVerificationCode.email
})
.catch((error) => {
this.$toasted.error(error.message)
})
loader.hide()
this.pending = false
},
},
mounted() {