mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
check API to reset password
This commit is contained in:
parent
e45f79f927
commit
1023e8932a
@ -22,7 +22,7 @@ loginServer.db.user = root
|
|||||||
loginServer.db.password =
|
loginServer.db.password =
|
||||||
loginServer.db.port = 3306
|
loginServer.db.port = 3306
|
||||||
|
|
||||||
frontend.checkEmailPath = http://localhost/account/checkEmail
|
frontend.checkEmailPath = http://localhost/reset
|
||||||
|
|
||||||
email.disable = true
|
email.disable = true
|
||||||
|
|
||||||
|
|||||||
@ -64,7 +64,6 @@ const loginAPI = {
|
|||||||
return apiPost(CONFIG.LOGIN_API_URL + 'createUser', payload)
|
return apiPost(CONFIG.LOGIN_API_URL + 'createUser', payload)
|
||||||
},
|
},
|
||||||
sendEmail: async (email, email_text = 7, email_verification_code_type = 'resetPassword') => {
|
sendEmail: async (email, email_text = 7, email_verification_code_type = 'resetPassword') => {
|
||||||
//console.log('api email', email)
|
|
||||||
const payload = {
|
const payload = {
|
||||||
email,
|
email,
|
||||||
email_text,
|
email_text,
|
||||||
@ -72,6 +71,23 @@ const loginAPI = {
|
|||||||
}
|
}
|
||||||
return apiPost(CONFIG.LOGIN_API_URL + 'sendEmail', payload)
|
return apiPost(CONFIG.LOGIN_API_URL + 'sendEmail', payload)
|
||||||
},
|
},
|
||||||
|
loginViaEmailVerificationCode: async (optin) => {
|
||||||
|
return apiGet(
|
||||||
|
CONFIG.LOGIN_API_URL
|
||||||
|
+ 'loginViaEmailVerificationCode?emailVerificationCode='
|
||||||
|
+ optin
|
||||||
|
)
|
||||||
|
},
|
||||||
|
changePassword: async (session_id, email, password) => {
|
||||||
|
const payload = {
|
||||||
|
session_id,
|
||||||
|
email,
|
||||||
|
'update': {
|
||||||
|
'User.password': password,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return apiPost(CONFIG.LOGIN_API_URL + 'updateUserInfos', payload)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default loginAPI
|
export default loginAPI
|
||||||
|
|||||||
@ -59,7 +59,7 @@ const routes = [
|
|||||||
component: () => import('../views/Pages/ForgotPassword.vue'),
|
component: () => import('../views/Pages/ForgotPassword.vue'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/reset',
|
path: '/reset/:optin',
|
||||||
component: () => import('../views/Pages/ResetPassword.vue'),
|
component: () => import('../views/Pages/ResetPassword.vue'),
|
||||||
},
|
},
|
||||||
{ path: '*', component: NotFound },
|
{ path: '*', component: NotFound },
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="resetpwd-form">
|
<div class="resetpwd-form" v-if="authenticated">
|
||||||
<!-- Header -->
|
<!-- Header -->
|
||||||
<div class="header p-4">
|
<div class="header p-4">
|
||||||
<b-container class="container">
|
<b-container class="container">
|
||||||
@ -91,6 +91,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import loginAPI from '../../apis/loginAPI'
|
||||||
export default {
|
export default {
|
||||||
name: 'reset',
|
name: 'reset',
|
||||||
data() {
|
data() {
|
||||||
@ -105,6 +106,8 @@ export default {
|
|||||||
checkPassword: '',
|
checkPassword: '',
|
||||||
passwordVisible: false,
|
passwordVisible: false,
|
||||||
submitted: false,
|
submitted: false,
|
||||||
|
authenticated: false,
|
||||||
|
session_id: null,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -139,8 +142,16 @@ export default {
|
|||||||
return { valid: false, errors }
|
return { valid: false, errors }
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
created() {
|
async created() {
|
||||||
//console.log('resetpage', this.$route)
|
const optin = this.$route.params.optin
|
||||||
|
const result = await loginAPI.loginViaEmailVerificationCode(optin)
|
||||||
|
console.log('result', result)
|
||||||
|
if (result.success) {
|
||||||
|
this.authenticated = true
|
||||||
|
this.session_id = result.result.data.session_id
|
||||||
|
} else {
|
||||||
|
alert(result.result.message)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user