mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
reset pwd clear data files seperated
This commit is contained in:
parent
8ae2e65e12
commit
b4f1096048
@ -60,7 +60,10 @@ export default {
|
|||||||
this.$router.push('overview')
|
this.$router.push('overview')
|
||||||
} else {
|
} else {
|
||||||
//console.log('app.vue to Logout')
|
//console.log('app.vue to Logout')
|
||||||
this.$store.dispatch('logout')
|
if (this.$route.path == '/reset') {
|
||||||
|
} else {
|
||||||
|
this.$store.dispatch('logout')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
|||||||
@ -63,6 +63,15 @@ 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') => {
|
||||||
|
//console.log('api email', email)
|
||||||
|
const payload = {
|
||||||
|
email,
|
||||||
|
email_text,
|
||||||
|
email_verification_code_type,
|
||||||
|
}
|
||||||
|
return apiPost(CONFIG.LOGIN_API_URL + 'sendEmail', payload)
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
export default loginAPI
|
export default loginAPI
|
||||||
|
|||||||
@ -21,10 +21,6 @@ const router = new VueRouter({
|
|||||||
})
|
})
|
||||||
|
|
||||||
router.beforeEach((to, from, next) => {
|
router.beforeEach((to, from, next) => {
|
||||||
let language = to.params.lang
|
|
||||||
if (!language) {
|
|
||||||
language = 'de'
|
|
||||||
}
|
|
||||||
next()
|
next()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import NotFound from '@/views/NotFoundPage.vue'
|
|||||||
const routes = [
|
const routes = [
|
||||||
{
|
{
|
||||||
path: '/overview',
|
path: '/overview',
|
||||||
component: () => import('../views/KontoOverview.vue'),
|
component: () => import('../views/Pages/KontoOverview.vue'),
|
||||||
meta: {
|
meta: {
|
||||||
requiresAuth: true,
|
requiresAuth: true,
|
||||||
},
|
},
|
||||||
@ -38,7 +38,7 @@ const routes = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/password',
|
path: '/password',
|
||||||
component: () => import('../views/Pages/Password.vue'),
|
component: () => import('../views/Pages/ForgotPassword.vue'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/explorer',
|
path: '/explorer',
|
||||||
|
|||||||
@ -63,7 +63,6 @@ export const store = new Vuex.Store({
|
|||||||
state.user.balance_gdt = balance / 10000
|
state.user.balance_gdt = balance / 10000
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// Asyncronous actions - used for api calls
|
|
||||||
actions: {
|
actions: {
|
||||||
login: async ({ dispatch, commit }, data) => {
|
login: async ({ dispatch, commit }, data) => {
|
||||||
const result = await loginAPI.login(data.email, data.password)
|
const result = await loginAPI.login(data.email, data.password)
|
||||||
@ -74,19 +73,11 @@ export const store = new Vuex.Store({
|
|||||||
$cookies.set('gdd_u', data.email)
|
$cookies.set('gdd_u', data.email)
|
||||||
router.push('/overview')
|
router.push('/overview')
|
||||||
} else {
|
} else {
|
||||||
// Register failed, we perform a logout
|
|
||||||
//alert('>>>>> FAIl LOGIN')
|
|
||||||
commit('loginfail', true)
|
commit('loginfail', true)
|
||||||
|
|
||||||
//dispatch('logout')
|
//dispatch('logout')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
passwordReset: async (data) => {
|
|
||||||
//console.log('<<<<<<<<<<< PASSWORT RESET TODO >>>>>>>>>>>', data.email)
|
|
||||||
},
|
|
||||||
schoepfen: async (data) => {
|
|
||||||
// http://localhost/transaction-creations/ajaxCreate
|
|
||||||
},
|
|
||||||
createUser: async ({ commit, dispatch }, data) => {
|
createUser: async ({ commit, dispatch }, data) => {
|
||||||
// console.log('action: createUser')
|
// console.log('action: createUser')
|
||||||
const result = await loginAPI.create(
|
const result = await loginAPI.create(
|
||||||
|
|||||||
@ -26,17 +26,10 @@
|
|||||||
:placeholder="$t('form.email')"
|
:placeholder="$t('form.email')"
|
||||||
name="Email"
|
name="Email"
|
||||||
:rules="{ required: true, email: true }"
|
:rules="{ required: true, email: true }"
|
||||||
v-model="model.email"
|
v-model="form.email"
|
||||||
></base-input>
|
></base-input>
|
||||||
{{ form }}
|
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<b-button
|
<b-button type="submit" outline variant="secondary" class="mt-4">
|
||||||
type="submit"
|
|
||||||
outline
|
|
||||||
variant="secondary"
|
|
||||||
class="mt-4"
|
|
||||||
:disabled="disable"
|
|
||||||
>
|
|
||||||
{{ $t('site.password.reset_now') }}
|
{{ $t('site.password.reset_now') }}
|
||||||
</b-button>
|
</b-button>
|
||||||
</div>
|
</div>
|
||||||
@ -53,21 +46,26 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import loginAPI from '../../apis/loginAPI.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'password',
|
name: 'password',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
disable: 'disabled',
|
disable: 'disabled',
|
||||||
model: {
|
form: {
|
||||||
email: '',
|
email: '',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onSubmit() {
|
async onSubmit() {
|
||||||
this.$store.dispatch('passwordReset', { email: this.model.email })
|
const result = await loginAPI.sendEmail(this.form.email)
|
||||||
this.model.email = ''
|
if (result.success) {
|
||||||
this.$router.push('/thx')
|
this.$router.push({ path: '/thx', params: { id: 'resetmail' } })
|
||||||
|
} else {
|
||||||
|
alert(result.result)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -20,9 +20,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import GddStatus from './KontoOverview/GddStatus.vue'
|
import GddStatus from '../KontoOverview/GddStatus.vue'
|
||||||
import GddSend from './KontoOverview/GddSend.vue'
|
import GddSend from '../KontoOverview/GddSend.vue'
|
||||||
import GddTable from './KontoOverview/GddTable.vue'
|
import GddTable from '../KontoOverview/GddTable.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Overview',
|
name: 'Overview',
|
||||||
@ -89,6 +89,9 @@
|
|||||||
</router-link>
|
</router-link>
|
||||||
</b-col>
|
</b-col>
|
||||||
</b-row>
|
</b-row>
|
||||||
|
<b-row>
|
||||||
|
<b-col><router-link to="/reset">reset</router-link></b-col>
|
||||||
|
</b-row>
|
||||||
</b-col>
|
</b-col>
|
||||||
</b-row>
|
</b-row>
|
||||||
</b-container>
|
</b-container>
|
||||||
|
|||||||
147
frontend/src/views/Pages/ResetPassword.vue
Normal file
147
frontend/src/views/Pages/ResetPassword.vue
Normal file
@ -0,0 +1,147 @@
|
|||||||
|
<template>
|
||||||
|
<div class="register-form">
|
||||||
|
<!-- Header -->
|
||||||
|
<div class="header p-4">
|
||||||
|
<b-container class="container">
|
||||||
|
<div class="header-body text-center mb-7">
|
||||||
|
<b-row class="justify-content-center">
|
||||||
|
<b-col xl="5" lg="6" md="8" class="px-2">
|
||||||
|
<h1>Reset Password</h1>
|
||||||
|
<div class="pb-4">
|
||||||
|
Jetzt kannst du ein neues Passwort speichern, mit welchem du dich zukünfitg in der
|
||||||
|
GRADIDO App anmelden kannst.
|
||||||
|
</div>
|
||||||
|
</b-col>
|
||||||
|
</b-row>
|
||||||
|
</div>
|
||||||
|
</b-container>
|
||||||
|
</div>
|
||||||
|
<!-- Page content -->
|
||||||
|
<b-container class="mt--8 p-1">
|
||||||
|
<!-- Table -->
|
||||||
|
<b-row class="justify-content-center">
|
||||||
|
<b-col lg="6" md="8">
|
||||||
|
<b-card no-body class="border-0" style="background-color: #ebebeba3 !important">
|
||||||
|
<b-card-body class="py-lg-4 px-sm-0 px-0 px-md-2 px-lg-4">
|
||||||
|
<validation-observer v-slot="{ handleSubmit }" ref="formValidator">
|
||||||
|
<b-form role="form" @submit.prevent="handleSubmit(onSubmit)">
|
||||||
|
<b-form-group :label="$t('form.password')">
|
||||||
|
<b-input-group>
|
||||||
|
<b-form-input
|
||||||
|
class="mb-0"
|
||||||
|
v-model="password"
|
||||||
|
name="password"
|
||||||
|
:class="{ valid: passwordValidation.valid }"
|
||||||
|
:type="passwordVisible ? 'text' : 'password'"
|
||||||
|
prepend-icon="ni ni-lock-circle-open"
|
||||||
|
:placeholder="$t('form.password')"
|
||||||
|
></b-form-input>
|
||||||
|
|
||||||
|
<b-input-group-append>
|
||||||
|
<b-button variant="outline-primary">
|
||||||
|
<b-icon
|
||||||
|
:icon="passwordVisible ? 'eye' : 'eye-slash'"
|
||||||
|
@click="togglePasswordVisibility"
|
||||||
|
/>
|
||||||
|
</b-button>
|
||||||
|
</b-input-group-append>
|
||||||
|
</b-input-group>
|
||||||
|
</b-form-group>
|
||||||
|
|
||||||
|
<base-input
|
||||||
|
:label="$t('form.password_repeat')"
|
||||||
|
type="password"
|
||||||
|
name="password-repeat"
|
||||||
|
:placeholder="$t('form.password_repeat')"
|
||||||
|
prepend-icon="ni ni-lock-circle-open"
|
||||||
|
v-model.lazy="checkPassword"
|
||||||
|
:class="{ valid: passwordValidation.valid }"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<transition name="hint" appear>
|
||||||
|
<div v-if="passwordValidation.errors.length > 0 && !submitted" class="hints">
|
||||||
|
<ul>
|
||||||
|
<li v-for="error in passwordValidation.errors" :key="error">
|
||||||
|
<small>{{ error }}</small>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="matches" v-else-if="!samePasswords">
|
||||||
|
<p>
|
||||||
|
{{ $t('site.signup.dont_match') }}
|
||||||
|
<i class="ni ni-active-40" color="danger"></i>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</transition>
|
||||||
|
<div
|
||||||
|
class="text-center"
|
||||||
|
v-if="passwordsFilled && samePasswords && passwordValidation.valid"
|
||||||
|
>
|
||||||
|
<b-button type="submit" variant="secondary" class="mt-4">
|
||||||
|
{{ $t('signup') }}
|
||||||
|
</b-button>
|
||||||
|
</div>
|
||||||
|
</b-form>
|
||||||
|
</validation-observer>
|
||||||
|
</b-card-body>
|
||||||
|
</b-card>
|
||||||
|
</b-col>
|
||||||
|
</b-row>
|
||||||
|
</b-container>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'reset',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
rules: [
|
||||||
|
{ message: this.$t('site.signup.lowercase'), regex: /[a-z]+/ },
|
||||||
|
{ message: this.$t('site.signup.uppercase'), regex: /[A-Z]+/ },
|
||||||
|
{ message: this.$t('site.signup.minimum'), regex: /.{8,}/ },
|
||||||
|
{ message: this.$t('site.signup.one_number'), regex: /[0-9]+/ },
|
||||||
|
],
|
||||||
|
password: '',
|
||||||
|
checkPassword: '',
|
||||||
|
passwordVisible: false,
|
||||||
|
submitted: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
togglePasswordVisibility() {
|
||||||
|
this.passwordVisible = !this.passwordVisible
|
||||||
|
},
|
||||||
|
onSubmit() {
|
||||||
|
this.$store.dispatch('createUser', {
|
||||||
|
password: this.model.password,
|
||||||
|
})
|
||||||
|
this.model.password = ''
|
||||||
|
this.$router.push('/thx')
|
||||||
|
},
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
samePasswords() {
|
||||||
|
return this.password === this.checkPassword
|
||||||
|
},
|
||||||
|
passwordsFilled() {
|
||||||
|
return this.password !== '' && this.checkPassword !== ''
|
||||||
|
},
|
||||||
|
passwordValidation() {
|
||||||
|
let errors = []
|
||||||
|
for (let condition of this.rules) {
|
||||||
|
if (!condition.regex.test(this.password)) {
|
||||||
|
errors.push(condition.message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (errors.length === 0) {
|
||||||
|
return { valid: true, errors }
|
||||||
|
}
|
||||||
|
return { valid: false, errors }
|
||||||
|
},
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
//console.log('resetpage', this.$route)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style></style>
|
||||||
Loading…
x
Reference in New Issue
Block a user