add sanity checks for importing bulk contacts, eg. when there is a truncated link
This commit is contained in:
@@ -1,14 +1,20 @@
|
||||
<template>
|
||||
<QuickNav selected="Invite" />
|
||||
<section id="Content" class="p-6 pb-24 max-w-3xl mx-auto">
|
||||
<div v-if="acceptInput" class="text-center mt-4">
|
||||
<div
|
||||
v-if="checkingInvite"
|
||||
class="text-lg text-center font-light relative px-7"
|
||||
>
|
||||
<fa icon="spinner" class="fa-spin-pulse" />
|
||||
</div>
|
||||
<div v-else class="text-center mt-4">
|
||||
<p>That invitation did not work.</p>
|
||||
<p class="mt-2">
|
||||
Go back to your invite message and copy the entire text, then paste it
|
||||
here.
|
||||
</p>
|
||||
<p class="mt-2">
|
||||
If the link looks correct, try Chrome. (For example, iOS may have cut
|
||||
If the data looks correct, try Chrome. (For example, iOS may have cut
|
||||
off the invite data, or it may have shown a preview that stole your
|
||||
invite.) If it still complains, you may need the person who invited you
|
||||
to send a new one.
|
||||
@@ -25,16 +31,9 @@
|
||||
@click="() => processInvite(inputJwt, true)"
|
||||
class="ml-2 p-2 bg-blue-500 text-white rounded"
|
||||
>
|
||||
Submit
|
||||
Accept
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
v-if="checkingInvite"
|
||||
class="text-lg text-center font-light relative px-7"
|
||||
>
|
||||
<fa icon="spinner" class="fa-spin-pulse" />
|
||||
Loading…
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
@@ -43,7 +42,7 @@ import { Component, Vue } from "vue-facing-decorator";
|
||||
import { Router } from "vue-router";
|
||||
|
||||
import QuickNav from "@/components/QuickNav.vue";
|
||||
import { NotificationIface } from "@/constants/app";
|
||||
import { APP_SERVER, NotificationIface } from "@/constants/app";
|
||||
import {
|
||||
db,
|
||||
logConsoleAndDb,
|
||||
@@ -57,7 +56,6 @@ import { generateSaveAndActivateIdentity } from "@/libs/util";
|
||||
export default class InviteOneAcceptView extends Vue {
|
||||
$notify!: (notification: NotificationIface, timeout?: number) => void;
|
||||
|
||||
acceptInput: boolean = false;
|
||||
activeDid: string = "";
|
||||
apiServer: string = "";
|
||||
checkingInvite: boolean = true;
|
||||
@@ -91,6 +89,7 @@ export default class InviteOneAcceptView extends Vue {
|
||||
|
||||
// parse the string: extract the URL or JWT if surrounded by spaces
|
||||
// and then extract the JWT from the URL
|
||||
// (For another approach used with contacts, see getContactPayloadFromJwtUrl)
|
||||
const urlMatch = jwtInput.match(/(https?:\/\/[^\s]+)/);
|
||||
if (urlMatch && urlMatch[1]) {
|
||||
// extract the JWT from the URL, meaning any character except "?"
|
||||
@@ -112,13 +111,12 @@ export default class InviteOneAcceptView extends Vue {
|
||||
{
|
||||
group: "alert",
|
||||
type: "danger",
|
||||
title: "Missing invite",
|
||||
text: "There was no invite. Paste the entire text that has the link.",
|
||||
title: "Missing Invite",
|
||||
text: "There was no invite. Paste the entire text that has the data.",
|
||||
},
|
||||
5000,
|
||||
);
|
||||
}
|
||||
this.acceptInput = true;
|
||||
} else {
|
||||
//const payload: JWTPayload =
|
||||
decodeEndorserJwt(jwt);
|
||||
@@ -144,7 +142,6 @@ export default class InviteOneAcceptView extends Vue {
|
||||
3000,
|
||||
);
|
||||
}
|
||||
this.acceptInput = true;
|
||||
}
|
||||
this.checkingInvite = false;
|
||||
}
|
||||
@@ -152,6 +149,8 @@ export default class InviteOneAcceptView extends Vue {
|
||||
// check the invite JWT
|
||||
async checkInvite(jwtInput: string) {
|
||||
if (
|
||||
jwtInput.endsWith(APP_SERVER) ||
|
||||
jwtInput.endsWith(APP_SERVER + "/") ||
|
||||
jwtInput.endsWith("invite-one-accept") ||
|
||||
jwtInput.endsWith("invite-one-accept/")
|
||||
) {
|
||||
@@ -160,7 +159,7 @@ export default class InviteOneAcceptView extends Vue {
|
||||
group: "alert",
|
||||
type: "danger",
|
||||
title: "Error",
|
||||
text: "That is only part of the invite link; it's missing data at the end. Try another way to get the full link.",
|
||||
text: "That is only part of the invite data; it's missing some at the end. Try another way to get the full data.",
|
||||
},
|
||||
5000,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user