add user manage routes

This commit is contained in:
sentriz
2019-04-16 17:46:15 +01:00
parent 64fb0fdf82
commit 0d1c25a550
13 changed files with 234 additions and 106 deletions

View File

@@ -1,12 +0,0 @@
{{ define "title" }}home{{ end }}
{{ define "user" }}
<div class="padded box mono">
<div>
<span><u>create new user</u></span>
</div>
<div class="right">
<span class="pre">howdy</span><br/>
</div>
</div>
{{ end }}

View File

@@ -1,12 +0,0 @@
{{ define "title" }}gonic{{ end }}
{{ define "content" }}
<div class="light">
<span>login</span>
</div>
<form id="login-form" action="/admin/authenticate" method="post">
<input type="text" id="username" name="username" placeholder="username">
<input type="password" id="password" name="password" placeholder="password">
<input type="submit" value="login">
</form>
{{ end }}

View File

@@ -15,7 +15,7 @@
</div>
<div id="content">
{{ if .Flashes }}
<div id="flashes">
<div id="flashes" class="padded mono">
<p><b>warning:</b> {{ index .Flashes 0 }}</p>
</div>
{{ end }}

View File

@@ -0,0 +1,14 @@
{{ define "title" }}home{{ end }}
{{ define "user" }}
<div class="padded box mono">
<div class="box-title">
<span><u>changing {{ .SelectedUser.Name }}'s password</u></span>
</div>
<form id="login-form" action="/admin/change_password_do?user={{ .SelectedUser.Name }}" 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

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

View File

@@ -2,7 +2,7 @@
{{ define "user" }}
<div class="padded box mono">
<div>
<div class="box-title">
<span><u>stats</u></span>
</div>
<div class="right">
@@ -12,20 +12,20 @@
</div>
</div>
<div class="padded box mono">
<div>
<span><u>last.fm</u></span>
<div class="box-title">
<span><u>last fm</u></span>
</div>
<div class="right">
<span class="pre">unlinked</span><br/>
</div>
</div>
<div class="padded box mono">
<div>
<div class="box-title">
<span><u>users</u></span>
</div>
<div class="right">
{{ range $user := .Users }}
<span class="pre">{{ $user.Name }} <span class="light">created</span> <u>{{ $user.CreatedAt.Format "Jan 02, 2006" }}</u> <a href="/admin/change_password">change password</a></span><br/>
{{ range $user := .AllUsers }}
<span class="pre">{{ $user.Name }} <span class="light">created</span> <u>{{ $user.CreatedAt.Format "Jan 02, 2006" }}</u> <a href="/admin/change_password?user={{ $user.Name }}">change password</a></span><br/>
{{ end }}
<br>
<a href="/admin/create_user" class="button">create new</a>

View File

@@ -0,0 +1,14 @@
{{ define "title" }}gonic{{ end }}
{{ define "content" }}
<div class="padded box mono">
<div class="box-title">
<span><u>please login</u></span>
</div>
<form id="login-form" action="/admin/login_do" method="post">
<input type="text" id="username" name="username" placeholder="username">
<input type="password" id="password" name="password" placeholder="password">
<input type="submit" value="login">
</form>
</div>
{{ end }}

View File

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