Compare commits

..

No commits in common. "5ebcbb0ced6f784fe7c3d06d7932bb13259eb1c6" and "c514bc27dc6480f20a1623f2a5aa43e0cb73d0b4" have entirely different histories.

2 changed files with 7 additions and 78 deletions

View file

@ -1,23 +1,10 @@
<script> <script>
import { account, logOut, loggedInUser } from "./appwrite"; import { logOut, loggedInUser } from "./appwrite";
</script> </script>
<div class=""> <div class="">Welcome, {loggedInUser.name} <a href="#" class="text-blue-400" on:click={logOut}>Log out</a></div>
Welcome, {loggedInUser.name}
<a href="#" class="text-blue-400" on:click={logOut}>Log out</a>
</div>
{#if !loggedInUser.emailVerification} {#if !loggedInUser.emailVerification}
<div class=""> <div class="">You have not verified your email address yet</div>
You have not verified your email address yet <a
href="#"
class="text-blue-400"
on:click={() =>
account.createVerification(
window.location.protocol +
"//" +
window.location.host +
"/register/emailVerify",
)}>Resend verification email</a
>
</div>
{/if} {/if}

View file

@ -1,61 +1,3 @@
<script> <script>
import { navigate } from "svelte-navigator/src/history";
import { account, loggedInUser, teams } from "../lib/appwrite";
import Header from "../lib/Header.svelte";
import { Link } from "svelte-navigator";
const searchParams = new URLSearchParams(document.location.search);
let confirmed = false;
let alreadyConfirmed = false;
if (
loggedInUser !== null &&
searchParams.get("userId") == loggedInUser["$id"]
) {
account
.updateVerification(
searchParams.get("userId"),
searchParams.get("secret"),
)
.then((r) => {
console.log(r);
confirmed = true;
})
.catch((r) => {
if (r.type == "user_invalid_token") {
alreadyConfirmed = true;
}
});
}
</script> </script>
<main class="container m-5">
{#if loggedInUser !== null}
<Header />
{/if}
{#if loggedInUser == null}
Please log in to confirm your email address <Link
class="text-blue-400"
to="/login?redirect_uri={encodeURIComponent(window.location.href)}"
>Log in</Link
>
{/if}
{#if loggedInUser !== null && searchParams.get("userId") !== loggedInUser["$id"]}
You can't verify your email for a different account. Please log out and log
back into the correct user.
{/if}
{#if confirmed == true}
Your email address has been successfully confirmed! <Link to="/"
>Go home</Link
>
{/if}
{#if alreadyConfirmed == true}
This verification link is invalid. You may already used it, or it may have
expired. <Link to="/">Go home</Link>
{/if}
</main>