mirror of
https://github.com/JonasunderscoreJones/dash.jonasjones.dev.git
synced 2025-10-22 23:49:20 +02:00
updated signup page
This commit is contained in:
parent
6667addb2a
commit
b81646fc86
1 changed files with 31 additions and 7 deletions
|
@ -1,15 +1,20 @@
|
||||||
<script>
|
<script>
|
||||||
import { navigate } from 'svelte-routing';
|
import { navigate } from 'svelte-routing';
|
||||||
import { setSessionKey } from '../../utils/session.js';
|
import { setSessionKey } from '../../utils/session.js';
|
||||||
|
import { page } from '$app/state';
|
||||||
|
let username = '';
|
||||||
|
let firstname = '';
|
||||||
|
let lastname = '';
|
||||||
let email = '';
|
let email = '';
|
||||||
let password = '';
|
let password = '';
|
||||||
let errorMessage = '';
|
let errorMessage = '';
|
||||||
|
let showPassword = false;
|
||||||
|
|
||||||
const handleLogin = async () => {
|
const handleLogin = async () => {
|
||||||
try {
|
try {
|
||||||
const response = await fetch('https://accounts.jonasjones.dev/login', {
|
const response = await fetch('https://accounts.jonasjones.dev/signup', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify({ email, password }),
|
body: JSON.stringify({ email, password, username, firstname, lastname }),
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
}
|
}
|
||||||
|
@ -32,7 +37,7 @@
|
||||||
|
|
||||||
<div class="login-container">
|
<div class="login-container">
|
||||||
<div class="login-prompt">
|
<div class="login-prompt">
|
||||||
<h1>Login</h1>
|
<h1>Signup</h1>
|
||||||
|
|
||||||
{#if errorMessage}
|
{#if errorMessage}
|
||||||
<p style="color: red;">{errorMessage}</p>
|
<p style="color: red;">{errorMessage}</p>
|
||||||
|
@ -40,14 +45,33 @@
|
||||||
|
|
||||||
<form on:submit|preventDefault={handleLogin}>
|
<form on:submit|preventDefault={handleLogin}>
|
||||||
<label for="username">Username:</label>
|
<label for="username">Username:</label>
|
||||||
<input id="username" bind:value={email} required />
|
<input id="username" bind:value={username} required />
|
||||||
|
|
||||||
|
<label for="firstname">First Name:</label>
|
||||||
|
<input id="firstname" bind:value={firstname} required />
|
||||||
|
|
||||||
|
<label for="lastname">Last Name:</label>
|
||||||
|
<input id="lastname" bind:value={lastname} required />
|
||||||
|
|
||||||
|
<label for="email">Email:</label>
|
||||||
|
<input id="email" bind:value={email} required />
|
||||||
|
|
||||||
<label for="password">Password:</label>
|
<label for="password">Password:</label>
|
||||||
<input type="password" id="password" bind:value={password} required />
|
|
||||||
|
|
||||||
<p>Have no account? <a href="/register">Register!</a></p>
|
<div style="display: flex; align-items: center;">
|
||||||
|
<input style="flex-grow: 1; margin-right: 10px;" type={showPassword ? 'text' : 'password'} id="password" bind:value={password} required />
|
||||||
|
|
||||||
<button type="submit">Login</button>
|
<button
|
||||||
|
type="button"
|
||||||
|
on:click={() => showPassword = !showPassword}
|
||||||
|
style="border: none; cursor: pointer; margin-top: -14px;"
|
||||||
|
aria-label={showPassword ? 'Hide password' : 'Show password'}
|
||||||
|
>
|
||||||
|
<i class={showPassword ? 'fas fa-eye-slash' : 'fas fa-eye'}></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="submit">Signup</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue