refactor validation and add admin system

This commit is contained in:
sentriz
2019-04-17 17:33:47 +01:00
parent 0d1c25a550
commit 9f6cd20f5a
11 changed files with 169 additions and 68 deletions

View File

@@ -0,0 +1,14 @@
{{ define "title" }}home{{ end }}
{{ define "user" }}
<div class="padded box mono">
<div class="box-title">
<span><u>changing account password</u></span>
</div>
<form id="login-form" action="/admin/change_own_password_do" method="post">
<input type="password" id="password_one" name="password_one" placeholder="new password">
<input type="password" id="password_two" name="password_two" placeholder="verify new password">
<input type="submit" value="change">
</form>
</div>
{{ end }}

View File

@@ -20,6 +20,8 @@
</div>
</div>
<div class="padded box mono">
{{ if .User.IsAdmin }}
{{/* admin panel to manage all users */}}
<div class="box-title">
<span><u>users</u></span>
</div>
@@ -30,5 +32,14 @@
<br>
<a href="/admin/create_user" class="button">create new</a>
</div>
{{ else }}
{{/* user panel to manage themselves */}}
<div class="box-title">
<span><u>your account</u></span>
</div>
<div class="right">
<a href="/admin/change_own_password" class="button">change password</a>
</div>
{{ end }}
</div>
{{ end }}

View File

@@ -2,7 +2,7 @@
{{ define "content" }}
<div class="light right">
<span>welcome <u>{{ .User.Name }}</u> &#124; <a href="/admin/logout">logout</a></span>
<span>welcome <u>{{ .User.Name }}</u> &#124; <a href="/admin/home">home</a> &#124; <a href="/admin/logout">logout</a></span>
</div>
{{ template "user" . }}
{{ end }}