Skip to content

Commit e8225b1

Browse files
added invetation
1 parent bb48500 commit e8225b1

4 files changed

Lines changed: 141 additions & 4 deletions

File tree

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
<template>
2+
<v-form @submit.prevent="handleAccept()" ref="form" v-model="valid">
3+
<v-card>
4+
<v-card-text>
5+
<img :src="require('../assets/logo.png')" class="logo">
6+
<template v-if="!loading">
7+
<v-alert
8+
:value="errorMessage !== null"
9+
class="mb-4"
10+
transition="fade-transition"
11+
type="error"
12+
>
13+
{{errorMessage}}
14+
</v-alert>
15+
<v-text-field
16+
:rules="[(v) => !!v || 'E-Mail is verplicht']"
17+
label="E-Mail"
18+
v-model="email"
19+
></v-text-field>
20+
<v-text-field
21+
:append-icon="showpassword ? 'fa-eye-slash' : 'fa-eye'"
22+
:rules="[(v) => !!v || 'Wachtwoord is verplicht', v => serverError('password', v)]"
23+
:type="showpassword ? 'text' : 'password'"
24+
@click:append="showpassword = !showpassword"
25+
label="Wachtwoord"
26+
v-model="password"
27+
></v-text-field>
28+
<v-text-field
29+
:append-icon="showpassword ? 'fa-eye-slash' : 'fa-eye'"
30+
:rules="[(v) => !!v || 'Wachtwoord is verplicht']"
31+
:type="showpassword ? 'text' : 'password'"
32+
@click:append="showpassword = !showpassword"
33+
label="Wachtwoord"
34+
v-model="password_confirmation"
35+
></v-text-field>
36+
</template>
37+
<div class="text-xs-center" v-else>
38+
<v-progress-circular
39+
:size="70"
40+
:width="7"
41+
color="accent"
42+
indeterminate
43+
></v-progress-circular>
44+
</div>
45+
</v-card-text>
46+
<v-card-actions>
47+
<v-spacer></v-spacer>
48+
<v-btn @click="handleAccept()" type="submit" color="accent">Uitnodiging accepteren</v-btn>
49+
</v-card-actions>
50+
</v-card>
51+
</v-form>
52+
</template>
53+
54+
<script>
55+
56+
export default {
57+
components: {},
58+
watch: {},
59+
props: [],
60+
name: '',
61+
data() {
62+
return {
63+
loading: false,
64+
valid: null,
65+
email: '',
66+
password: '',
67+
password_confirmation: '',
68+
errorMessage: null,
69+
showpassword: false,
70+
errors: {},
71+
};
72+
},
73+
created() {
74+
if (this.$store.getters['Authorization/isLoggedIn']) {
75+
this.$router.push({name: 'home'});
76+
}
77+
this.email = this.$route.query.email;
78+
},
79+
methods: {
80+
handleAccept() {
81+
this.$refs.form.validate();
82+
this.loading = true;
83+
this.$http.post('invitation/accept', {
84+
email: this.email,
85+
password: this.password,
86+
password_confirmation: this.password_confirmation,
87+
token: this.$route.params.token,
88+
}).then(() => {
89+
this.loading = false;
90+
this.handleLogin();
91+
}).catch((error) => {
92+
this.loading = false;
93+
if (error.response.status === 422) {
94+
this.errors = error.response.data.errors;
95+
process.nextTick(() => {
96+
this.$refs.form.validate();
97+
});
98+
} else {
99+
this.errorMessage = 'Er ging iets mis.';
100+
if(typeof error.response.data.message !== 'undefined' && error.response.data.message !== null) {
101+
this.errorMessage = error.response.data.message;
102+
}
103+
}
104+
});
105+
},
106+
handleLogin() {
107+
this.$router.push({name: 'login'});
108+
}, serverError(name, v) {
109+
if (this.errors !== null && typeof this.errors[name] !== 'undefined') {
110+
return this.errors[name][0];
111+
}
112+
return true;
113+
},
114+
},
115+
};
116+
</script>
117+
118+
<style scoped lang="scss">
119+
.logo {
120+
display: block;
121+
margin: 0 auto;
122+
}
123+
</style>

generator/templates/Authorisation/src/Views/PasswordReset.vue

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,20 @@
8787
token: this.$route.params.token,
8888
}).then(() => {
8989
this.loading = false;
90-
this.$router.push({name: login});
90+
this.handleLogin();
9191
}).catch((error) => {
9292
this.loading = false;
9393
if (error.response.status === 422) {
9494
this.errors = error.response.data.errors;
9595
process.nextTick(() => {
9696
this.$refs.form.validate();
9797
});
98+
} else {
99+
this.errorMessage = 'Er ging iets mis.';
100+
if (typeof error.response.data.message !== 'undefined' && error.response.data.message !== null) {
101+
this.errorMessage = error.response.data.message;
102+
}
98103
}
99-
this.errorMessage = 'Er ging iets mis.';
100104
});
101105
},
102106
handleLogin() {
@@ -116,4 +120,4 @@
116120
display: block;
117121
margin: 0 auto;
118122
}
119-
</style>
123+
</style>

generator/templates/Default/src/router.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,16 @@ export default new Router({
4343
},
4444
<%_ } _%>
4545
},
46+
{
47+
path: '/invitation/accept/:token',
48+
name: 'invitation.accept',
49+
component: () => import('./views/InvitationAccept.vue'),
50+
<%_ if (options.useTemplateLoader) { _%>
51+
meta: {
52+
template: () => import('./templates/Authorisation.vue'),
53+
},
54+
<%_ } _%>
55+
},
4656
{
4757
path: '/profile',
4858
name: 'profile',

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-cli-plugin-kingscode-scaffold",
3-
"version": "0.1.2",
3+
"version": "0.1.3",
44
"description": "",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)