Skip to content

Commit e36078f

Browse files
add new authorisatrion routes
1 parent 4514c3a commit e36078f

17 files changed

Lines changed: 76 additions & 31 deletions

File tree

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@ vue add kingscode-scaffold
1010
npm run serve
1111
```
1212

13-
Mind that some of the choices you make in the `vue create my-app` and
14-
later in the `vue add vuetify` will be overwritten by vuetify or the kings code scaffold.
13+
Mind that some choices you make in the `vue create my-app` and
14+
later in the `vue add vuetify` will be overwritten by vuetify, or the kings code scaffold.
1515

1616

1717
## Configuration
1818

19-
```
20-
Notice: it does not matter which choice you make with options that are not documented.
21-
```
19+
> Notice: it does not matter which choice you make with options that are not documented.
20+
2221

2322
### Vue:
2423
We'd recommend you to choose

generator/templates/Authorisation/src/api/endpoints/authorisation/login.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { post } from '../../implementation/app';
22

33
export default function (email, password) {
44
return post('auth/login', {
5-
email: email,
6-
password: password,
5+
email,
6+
password,
77
});
88
}

generator/templates/Authorisation/src/api/endpoints/authorisation/password.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ import { post } from '../../implementation/app';
22

33
function passwordForgotten(email) {
44
return post('password/forgotten', {
5-
email: email,
5+
email,
66
});
77
}
88

99
function passwordReset(token, email, password, passwordConfirmation) {
1010
return post('password/reset', {
11-
token: token,
12-
email: email,
13-
password: password,
11+
token,
12+
email,
13+
password,
1414
password_confirmation: passwordConfirmation,
1515
});
1616
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { post } from '@/api/implementation/app';
2+
3+
export default function (email) {
4+
return post('password/forgotten', {
5+
email,
6+
});
7+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { post } from '@/api/implementation/app';
2+
3+
export default async function (email, token, password, passwordConfirmation) {
4+
return post('password/reset', {
5+
email,
6+
token,
7+
password,
8+
password_confirmation: passwordConfirmation,
9+
});
10+
}
Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
import { post } from '../../implementation/app';
22

3-
function register(email, name) {
4-
return post('registration', {
3+
function verify(token, email, password, passwordConfirmation) {
4+
return post('registration/verify', {
5+
token,
56
email,
6-
name,
7+
password,
8+
password_confirmation: passwordConfirmation,
79
});
810
}
911

10-
function verify(token, email, password, passwordConfirmation) {
11-
return post('registration/verify', {
12-
token: token,
12+
function acceptInvitation(email, token, password, passwordConfirmation) {
13+
return post('invitation/accept', {
1314
email: email,
1415
password: password,
1516
password_confirmation: passwordConfirmation,
17+
token: token,
1618
});
1719
}
1820

1921
export {
20-
register,
2122
verify,
23+
acceptInvitation,
2224
};

generator/templates/Authorisation/src/components/Authorisation/LoginCard.vue

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151

5252
<script>
5353
import { getRateLimitMinutes } from '@/api/util/response';
54-
import { getOrganisationFromUrl } from '@/application/util/url.js';
5554
import KFieldGroup from '@/components/crud/fields/KFieldGroup.vue';
5655
import KTextField from '@/components/crud/fields/KTextField.vue';
5756
import { mapGetters } from 'vuex';
@@ -124,11 +123,6 @@ export default {
124123
tokenElement.value = token;
125124
form.appendChild(tokenElement);
126125
127-
const organisationElement = document.createElement('input');
128-
organisationElement.name = 'organisation';
129-
organisationElement.value = getOrganisationFromUrl();
130-
form.appendChild(organisationElement);
131-
132126
document.body.appendChild(form);
133127
form.submit();
134128
},

generator/templates/Authorisation/src/components/Authorisation/PasswordForgottenCard.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
import KFieldGroup from '@/components/crud/fields/KFieldGroup.vue';
4343
import KTextField from '@/components/crud/fields/KTextField.vue';
4444
import ForgottenRequest from '../../api/endpoints/authorisation/password/forgotten';
45-
import { getOrganisationFromUrl } from '../../application/util/url.js';
4645
4746
export default {
4847
name: 'PasswordForgottenCard',
@@ -71,7 +70,7 @@ export default {
7170
this.alertMessage = '';
7271
this.alertType = 'error';
7372
74-
ForgottenRequest(this.form.email, getOrganisationFromUrl())
73+
ForgottenRequest(this.form.email)
7574
.then(() => {
7675
this.alertMessage = this.$t('authorisation.passwordForgotten.successMessage');
7776
this.alertType = 'success';

generator/templates/Authorisation/src/components/Authorisation/PasswordResetCard.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545

4646
<script>
4747
import { getRateLimitMinutes } from '@/api/util/response.js';
48-
import { getOrganisationFromUrl } from '@/application/util/url.js';
4948
import KFieldGroup from '@/components/crud/fields/KFieldGroup.vue';
5049
import KTextField from '@/components/crud/fields/KTextField.vue';
5150
import resetRequest from '../../api/endpoints/authorisation/password/reset';
@@ -89,7 +88,7 @@ export default {
8988
this.alertType = 'error';
9089
this.errorMessage = '';
9190
92-
resetRequest(this.form.email, this.token, this.form.password, this.form.passwordConfirmation, getOrganisationFromUrl())
91+
resetRequest(this.form.email, this.token, this.form.password, this.form.passwordConfirmation)
9392
.then(() => {
9493
this.alertType = 'success';
9594
this.alertMessage = this.$t('authorisation.passwordReset.successMessage');
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
export default {
2+
path: '',
3+
component: () => import('@/templates/Authorisation'),
4+
children: [
5+
{
6+
path: 'login',
7+
name: 'login',
8+
component: () => import('@/views/authorisation/Login.vue'),
9+
},
10+
{
11+
path: 'auth/callback',
12+
name: 'auth.callback',
13+
component: () => import('@/views/authorisation/AuthorisationCallback.vue'),
14+
},
15+
{
16+
path: 'password/forgotten',
17+
name: 'password.forgotten',
18+
component: () => import('@/views/authorisation/PasswordForgotten.vue'),
19+
},
20+
{
21+
path: 'password/reset/:token',
22+
name: 'password.reset',
23+
component: () => import('@/views/authorisation/PasswordReset.vue'),
24+
},
25+
{
26+
path: 'invitation/accept/:token',
27+
name: 'invitation.accept',
28+
component: () => import('@/views/authorisation/InvitationAccept.vue'),
29+
},
30+
{
31+
path: 'registration/verify',
32+
name: 'registration.verify',
33+
component: () => import('@/views/authorisation/RegistrationVerify.vue'),
34+
},
35+
],
36+
};

0 commit comments

Comments
 (0)