let admins and users change usernames

This commit is contained in:
sentriz
2020-07-16 23:29:48 +01:00
parent ab0d15982a
commit 2dcbdf312a
7 changed files with 90 additions and 3 deletions

View File

@@ -0,0 +1,11 @@
{{ define "user" }}
<div class="padded box">
<div class="box-title">
<i class="mdi mdi-account-key"></i> changing account username
</div>
<form class="block" action="{{ path "/admin/change_own_username_do" }}" method="post">
<input type="text" id="username" name="username" placeholder="new username">
<input type="submit" value="change">
</form>
</div>
{{ end }}

View File

@@ -0,0 +1,11 @@
{{ define "user" }}
<div class="padded box">
<div class="box-title">
<i class="mdi mdi-account-key"></i> changing {{ .SelectedUser.Name }}'s username
</div>
<form class="block" action="{{ printf "/admin/change_username_do?user=%s" .SelectedUser.Name | path }}" method="post">
<input type="text" id="username" name="username" placeholder="new username">
<input type="submit" value="change">
</form>
</div>
{{ end }}

View File

@@ -61,7 +61,9 @@
<i>{{ $user.Name }}</i>
<span class="text-light no-small">{{ $user.CreatedAt | date }}</span>
<span class="text-light">&#124;</span>
<a href="{{ printf "/admin/change_password?user=%s" $user.Name | path }}">change password&#8230;</a>
<a href="{{ printf "/admin/change_username?user=%s" $user.Name | path }}">username&#8230;</a>
<span class="text-light">&#124;</span>
<a href="{{ printf "/admin/change_password?user=%s" $user.Name | path }}">password&#8230;</a>
<span class="text-light">&#124;</span>
{{ if $user.IsAdmin }}
<span class="text-light">delete&#8230;</span>
@@ -78,6 +80,8 @@
<i class="mdi mdi-account"></i> your account
</div>
<div class="text-right">
<a href="{{ path "/admin/change_own_username" }}" class="button">change username&#8230;</a>
<span class="text-light">&#124;</span>
<a href="{{ path "/admin/change_own_password" }}" class="button">change password&#8230;</a>
</div>
{{ end }}