mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
setPassword in frontend
remove resetPassword
This commit is contained in:
parent
d1dfda81ce
commit
d5b2356caf
@ -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,
|
||||
|
||||
@ -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)
|
||||
}
|
||||
`
|
||||
|
||||
|
||||
@ -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() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user