feat: Add trust bridge and user activation
This commit is contained in:
parent
74afc805dc
commit
0f1cd98a80
8 changed files with 78 additions and 52 deletions
|
@ -43,12 +43,14 @@ export class User {
|
|||
email: string | undefined;
|
||||
password: string | undefined;
|
||||
username: string | null = null;
|
||||
confidantEmail: string | null = null;
|
||||
isAuthenticated = false;
|
||||
isTrusted = false;
|
||||
private token = "";
|
||||
|
||||
static async confirm(uid: string, token: string): Promise<void> {
|
||||
await api_request("POST", "users/activation", 204, { uid, token });
|
||||
async activate(): Promise<void> {
|
||||
await api_request("POST", "users/activate", 204, {
|
||||
password: this.password,
|
||||
});
|
||||
}
|
||||
|
||||
async login(): Promise<void> {
|
||||
|
@ -84,7 +86,6 @@ export class User {
|
|||
200,
|
||||
{
|
||||
username: this.username,
|
||||
confidant_email: this.confidantEmail,
|
||||
},
|
||||
this.token
|
||||
);
|
||||
|
|
|
@ -1,20 +1,8 @@
|
|||
<template>
|
||||
<div>
|
||||
<b-notification
|
||||
v-if="!user.username"
|
||||
type="is-warning"
|
||||
aria-close-label="Close notification"
|
||||
>
|
||||
Um dein Konto zu aktivieren, musst du einen
|
||||
<strong>Benutzernamen</strong> festlegen.
|
||||
</b-notification>
|
||||
<b-notification
|
||||
v-if="!user.confidant_email"
|
||||
type="is-warning"
|
||||
aria-close-label="Close notification"
|
||||
>
|
||||
Um dein Konto zu aktivieren, musst du eine
|
||||
<strong>Vertrauensperson</strong> angeben.
|
||||
<b-notification type="is-info" aria-close-label="Close notification">
|
||||
Dein Konto ist noch nicht aktiv.
|
||||
<a @click="activate()">Jetzt aktivieren</a>
|
||||
</b-notification>
|
||||
<table class="table is-fullwidth">
|
||||
<tbody>
|
||||
|
@ -34,10 +22,6 @@
|
|||
<inline-editor v-model="user.confidantEmail" @input="user.save()" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>E-Mail-Adresse</td>
|
||||
<td>{{ user.email }} (bestätigt)</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
@ -53,5 +37,9 @@ import InlineEditor from "@/components/InlineEditor.vue";
|
|||
})
|
||||
export default class UserTable extends Vue {
|
||||
@Prop() private user!: User;
|
||||
|
||||
async activate(): Promise<void> {
|
||||
await this.user.activate();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
Reference in a new issue