Show reason for invite accept failure if available (#473)

This commit is contained in:
Kyle Spearrin 2020-02-28 15:27:02 -05:00 committed by GitHub
parent 5c492f893b
commit e2108ff85b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 2 deletions

View File

@ -44,6 +44,7 @@ export class AcceptOrganizationComponent implements OnInit {
fired = true;
await this.stateService.remove('orgInvitation');
let error = qParams.organizationId == null || qParams.organizationUserId == null || qParams.token == null;
let errorMessage: string = null;
if (!error) {
this.authed = await this.userService.isAuthenticated();
if (this.authed) {
@ -61,8 +62,9 @@ export class AcceptOrganizationComponent implements OnInit {
};
this.toasterService.popAsync(toast);
this.router.navigate(['/vault']);
} catch {
} catch (e) {
error = true;
errorMessage = e.message;
}
} else {
await this.stateService.save('orgInvitation', qParams);
@ -76,7 +78,14 @@ export class AcceptOrganizationComponent implements OnInit {
}
if (error) {
this.toasterService.popAsync('error', null, this.i18nService.t('inviteAcceptFailed'));
const toast: Toast = {
type: 'error',
title: null,
body: errorMessage != null ? this.i18nService.t('inviteAcceptFailedShort', errorMessage) :
this.i18nService.t('inviteAcceptFailed'),
timeout: 10000,
};
this.toasterService.popAsync(toast);
this.router.navigate(['/']);
}

View File

@ -2578,6 +2578,15 @@
"inviteAcceptFailed": {
"message": "Unable to accept invitation. Ask an organization admin to send a new invitation."
},
"inviteAcceptFailedShort": {
"message": "Unable to accept invitation. $DESCRIPTION$",
"placeholders": {
"description": {
"content": "$1",
"example": "You must enable 2FA on your user account before you can join this organization."
}
}
},
"rememberEmail": {
"message": "Remember email"
},