Add login view
This commit is contained in:
parent
b7221cb364
commit
63b1cf1c3f
9 changed files with 687 additions and 2 deletions
assets
4
assets/migrations/1_user.down.sql
Normal file
4
assets/migrations/1_user.down.sql
Normal file
|
@ -0,0 +1,4 @@
|
|||
DROP TABLE "reset";
|
||||
DROP TABLE "confirmation";
|
||||
DROP TABLE "email";
|
||||
DROP TABLE "user";
|
37
assets/migrations/1_user.up.sql
Normal file
37
assets/migrations/1_user.up.sql
Normal file
|
@ -0,0 +1,37 @@
|
|||
CREATE TABLE "user" (
|
||||
"id" bigserial NOT NULL,
|
||||
"is_admin" boolean NOT NULL DEFAULT false,
|
||||
"password" bytea NULL,
|
||||
"created_at" timestamptz NOT NULL DEFAULT NOW(),
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
CREATE TABLE "email" (
|
||||
"address" text NOT NULL,
|
||||
"user_id" bigint NOT NULL,
|
||||
"created_at" timestamptz NOT NULL DEFAULT NOW(),
|
||||
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE,
|
||||
PRIMARY KEY ("address")
|
||||
);
|
||||
CREATE INDEX ON "email" ("user_id");
|
||||
|
||||
CREATE TABLE "confirmation" (
|
||||
"email_address" text NOT NULL,
|
||||
"user_id" bigint NOT NULL,
|
||||
"selector" text NOT NULL,
|
||||
"verifier" bytea NOT NULL, -- hashed
|
||||
"expires_at" timestamptz NOT NULL DEFAULT NOW(),
|
||||
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE,
|
||||
PRIMARY KEY ("selector")
|
||||
);
|
||||
CREATE INDEX ON "confirmation" ("user_id");
|
||||
|
||||
CREATE TABLE "reset" (
|
||||
"user_id" bigint NOT NULL,
|
||||
"selector" text NOT NULL,
|
||||
"verifier" bytea NOT NULL, -- hashed
|
||||
"expires_at" timestamptz NOT NULL DEFAULT NOW(),
|
||||
FOREIGN KEY ("user_id") REFERENCES "user" ("id") ON DELETE CASCADE,
|
||||
PRIMARY KEY ("selector")
|
||||
);
|
||||
CREATE UNIQUE INDEX ON "reset" ("user_id");
|
24
assets/templates/layouts/auth_login.tmpl
Normal file
24
assets/templates/layouts/auth_login.tmpl
Normal file
|
@ -0,0 +1,24 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>Landing Page</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Login</h1>
|
||||
{{- range .Errors }}
|
||||
<p class="is-error">{{ . }}</p>
|
||||
{{- end }}
|
||||
<form action="/login" method="post">
|
||||
<input type="email" name="login" required>
|
||||
<input type="password" name="password" required>
|
||||
{{ .csrfField }}
|
||||
<input type="submit" value="Log In">
|
||||
</form>
|
||||
</body>
|
||||
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue