added registeration and started user login

This commit is contained in:
Philipp 2021-08-29 19:26:01 +02:00
parent 3f2cbcea33
commit 7ec8dbc211
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 276B613AF9DBE9C3
14 changed files with 327 additions and 1 deletions

View file

@ -12,6 +12,8 @@
<body>
<nav class="navbar navbar-light container">
<a class="navbar-brand text-primary" href="/">goddit</a>
<div class="flex-fill"></div>
<a class="text-primary text-primary" href="/register">Register</a>
</nav>
<div class="header bg-light border-bottom border-top py-5">
<div class="container">

24
templates/user_login.html Normal file
View file

@ -0,0 +1,24 @@
{{define "header"}}
<h1 class="mb-0">Register</h1>
{{end}}
{{define "content"}}
<form action="/login" method="POST">
{{.CSRF}}
<div class="form-group">
<label>Username</label>
<input name="username" type="text" class="form-control {{with .Form.Errors.Title}}is-invalid{{end}}" placeholder="Enter your username" value="{{with .Form.Username}}{{.}}{{end}}">
{{with .Form.Errors.Username}}
<div class="invalid-feedack">{{.}}</div>
{{end}}
</div>
<div class="form-group">
<label>Password</label>
<input name="password" type="password" class="form-control {{with .Form.Errors.Password}}is-invalid{{end}}" placeholder="Enter your password" value="{{with .Form.Password}}{{.}}{{end}}">
{{with .Form.Errors.Password}}
<div class="invalid-feedack">{{.}}</div>
{{end}}
</div>
<button type="submit" class="btn btn-primary">Login</button>
</form>
{{end}}

View file

@ -0,0 +1,24 @@
{{define "header"}}
<h1 class="mb-0">Register</h1>
{{end}}
{{define "content"}}
<form action="/register" method="POST">
{{.CSRF}}
<div class="form-group">
<label>Username</label>
<input name="username" type="text" class="form-control {{with .Form.Errors.Title}}is-invalid{{end}}" placeholder="Choose a username" value="{{with .Form.Username}}{{.}}{{end}}">
{{with .Form.Errors.Username}}
<div class="invalid-feedack">{{.}}</div>
{{end}}
</div>
<div class="form-group">
<label>Password</label>
<input name="password" type="password" class="form-control {{with .Form.Errors.Password}}is-invalid{{end}}" placeholder="Please enter your password" value="{{with .Form.Password}}{{.}}{{end}}">
{{with .Form.Errors.Password}}
<div class="invalid-feedack">{{.}}</div>
{{end}}
</div>
<button type="submit" class="btn btn-primary">Register</button>
</form>
{{end}}