Add user management interface

This commit is contained in:
Las Zenow 2018-04-08 10:55:13 +00:00
parent 6cd5b1bc5e
commit 6f906ccae4
8 changed files with 124 additions and 8 deletions

View file

@ -72,6 +72,7 @@
<li><a href="/new/"><i class="icon-book"></i> New books</a></li>
{{if eq .Role "admin"}}
<li><a href="/news/edit"><i class="icon-certificate"></i> Edit news</a></li>
<li><a href="/admin/users/"><i class="icon-user"></i> Users admin</a></li>
{{end}}
<li class="divider"></li>
{{end}}

34
templates/user_admin.html Normal file
View file

@ -0,0 +1,34 @@
{{template "header.html" .S}}
<h4>Users:</h4>
<table class="table table-hover">
<thead>
<th>username</th>
<th>role</th>
<th>password</th>
<th>last login</th>
</thead>
<tbody>
{{range .Users}}
<tr>
<td>{{.Username}}</td>
<td><form class="row form-inline" method="POST" action="/admin/users/">
<input type="hidden" id="username" name="username" value="{{.Username}}">
<input type="text" id="role" name="role" value="{{.Role}}">
<button type="submit" class="btn btn-primary">Update</button>
</form>
</td>
<td><form class="row form-inline" method="POST" action="/admin/users/">
<input type="hidden" id="username" name="username" value="{{.Username}}">
<input type="password" id="password" name="password" placeholder="password">
<button type="submit" class="btn btn-primary">Update</button>
</form>
</td>
<td>{{.LastLogin.Format "2006-01-02"}}</td>
</tr>
{{end}}
</tbody>
</table>
{{template "footer.html"}}