create an identifier by default, while letting them choose if passkeys are enabled
This commit is contained in:
@@ -77,58 +77,28 @@
|
||||
|
||||
<div v-else>
|
||||
<!-- !isCreatingIdentifier -->
|
||||
<div
|
||||
v-if="!activeDid"
|
||||
class="bg-amber-200 rounded-md text-center px-4 py-3 mb-4"
|
||||
>
|
||||
<div v-if="PASSKEYS_ENABLED">
|
||||
<p class="text-lg mb-3">
|
||||
Choose how to see info from your contacts or share contributions:
|
||||
</p>
|
||||
<div class="flex justify-between">
|
||||
<button
|
||||
class="block text-center text-md font-bold bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white mt-2 px-2 py-3 rounded-md"
|
||||
@click="generateIdentifier()"
|
||||
>
|
||||
Let me start the easiest (with a passkey).
|
||||
</button>
|
||||
<router-link
|
||||
:to="{ name: 'start' }"
|
||||
class="block text-center text-md font-bold bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white mt-2 px-2 py-3 rounded-md"
|
||||
>
|
||||
Give me all the options.
|
||||
</router-link>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<p class="text-lg mb-3">
|
||||
To recognize giving or collaborate, have someone register you:
|
||||
</p>
|
||||
<router-link
|
||||
:to="{ name: 'contact-qr' }"
|
||||
class="block text-center text-md font-bold bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white mt-2 px-2 py-3 rounded-md"
|
||||
>
|
||||
Share your contact info.
|
||||
</router-link>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-else class="mb-4">
|
||||
<!-- activeDid -->
|
||||
|
||||
<!-- They should have an identifier, even if it's an auto-generated one that they'll never use. -->
|
||||
<div class="mb-4">
|
||||
<div
|
||||
v-if="!isRegistered"
|
||||
class="bg-amber-200 rounded-md overflow-hidden text-center px-4 py-3 mb-4"
|
||||
>
|
||||
<!-- activeDid && !isRegistered -->
|
||||
Someone must register you before you can give kudos or make offers
|
||||
or create projects... basically before doing anything.
|
||||
To share, someone must register you.
|
||||
<router-link
|
||||
:to="{ name: 'contact-qr' }"
|
||||
class="block text-center text-md font-bold bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white mt-2 px-2 py-3 rounded-md"
|
||||
>
|
||||
Show Them Your Identifier Info
|
||||
Show Them Default Identifier Info
|
||||
</router-link>
|
||||
<div v-if="PASSKEYS_ENABLED" class="flex justify-end w-full">
|
||||
<router-link
|
||||
:to="{ name: 'start' }"
|
||||
class="block text-right text-md font-bold bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white mt-2 px-2 py-3 rounded-md"
|
||||
>
|
||||
See all your options first
|
||||
</router-link>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-else>
|
||||
@@ -340,7 +310,11 @@ import FeedFilters from "@/components/FeedFilters.vue";
|
||||
import InfiniteScroll from "@/components/InfiniteScroll.vue";
|
||||
import QuickNav from "@/components/QuickNav.vue";
|
||||
import TopMessage from "@/components/TopMessage.vue";
|
||||
import { AppString, NotificationIface, PASSKEYS_ENABLED } from "@/constants/app";
|
||||
import {
|
||||
AppString,
|
||||
NotificationIface,
|
||||
PASSKEYS_ENABLED,
|
||||
} from "@/constants/app";
|
||||
import { db, accountsDB } from "@/db/index";
|
||||
import { Contact } from "@/db/tables/contacts";
|
||||
import {
|
||||
@@ -359,7 +333,10 @@ import {
|
||||
GiverReceiverInputInfo,
|
||||
GiveSummaryRecord,
|
||||
} from "@/libs/endorserServer";
|
||||
import { registerSaveAndActivatePasskey } from "@/libs/util";
|
||||
import {
|
||||
generateSaveAndActivateIdentity,
|
||||
registerSaveAndActivatePasskey,
|
||||
} from "@/libs/util";
|
||||
|
||||
interface GiveRecordWithContactInfo extends GiveSummaryRecord {
|
||||
giver: {
|
||||
@@ -423,7 +400,14 @@ export default class HomeView extends Vue {
|
||||
try {
|
||||
await accountsDB.open();
|
||||
const allAccounts = await accountsDB.accounts.toArray();
|
||||
this.allMyDids = allAccounts.map((acc) => acc.did);
|
||||
if (allAccounts.length > 0) {
|
||||
this.allMyDids = allAccounts.map((acc) => acc.did);
|
||||
} else {
|
||||
this.isCreatingIdentifier = true;
|
||||
const newDid = await generateSaveAndActivateIdentity();
|
||||
this.isCreatingIdentifier = false;
|
||||
this.allMyDids = [newDid];
|
||||
}
|
||||
|
||||
await db.open();
|
||||
const settings = (await db.settings.get(MASTER_SETTINGS_KEY)) as Settings;
|
||||
@@ -440,6 +424,7 @@ export default class HomeView extends Vue {
|
||||
|
||||
this.isAnyFeedFilterOn = isAnyFeedFilterOn(settings);
|
||||
|
||||
|
||||
// someone may have have registered after sharing contact info, so recheck
|
||||
if (!this.isRegistered && this.activeDid) {
|
||||
try {
|
||||
@@ -481,7 +466,7 @@ export default class HomeView extends Vue {
|
||||
}
|
||||
}
|
||||
|
||||
async generateIdentifier() {
|
||||
async generatePasskeyIdentifier() {
|
||||
this.isCreatingIdentifier = true;
|
||||
const account = await registerSaveAndActivatePasskey(
|
||||
AppString.APP_NAME + (this.givenName ? " - " + this.givenName : ""),
|
||||
|
||||
Reference in New Issue
Block a user