diff options
author | Marvin Borner | 2019-05-05 22:27:42 +0200 |
---|---|---|
committer | Marvin Borner | 2019-05-05 22:27:42 +0200 |
commit | bd89369b508f30fc987b27cf6b34a22fbc8e5d97 (patch) | |
tree | 8bb338a1112b4dae52d9d6d2919be4ce3d9544f9 /src/main/resources | |
parent | 5081b240b07f08e21ad124da8bddf0e11471792d (diff) |
Added simple admin interface
Co-authored-by: LarsVomMars <lars@kroenner.eu>
Diffstat (limited to 'src/main/resources')
-rw-r--r-- | src/main/resources/views/admin.rocker.html | 19 | ||||
-rw-r--r-- | src/main/resources/views/index.rocker.html | 4 | ||||
-rw-r--r-- | src/main/resources/views/register.rocker.html | 4 |
3 files changed, 25 insertions, 2 deletions
diff --git a/src/main/resources/views/admin.rocker.html b/src/main/resources/views/admin.rocker.html new file mode 100644 index 0000000..26859eb --- /dev/null +++ b/src/main/resources/views/admin.rocker.html @@ -0,0 +1,19 @@ +@args (String message) + +@layout.template("Index", RockerContent.NONE, RockerContent.NONE) -> { +<div class="flex"> + <div> + <h1>Add new user</h1> + <form action="/user/add" method="post"> + <label for="username">Username:</label> + <input autocomplete="off" autofocus id="username" name="username" required type="text"/> + <button type="submit">Generate</button> + </form> + </div> + <div> + @if (message.length() > 0) { + <small>@message</small> + } + </div> +</div> +} diff --git a/src/main/resources/views/index.rocker.html b/src/main/resources/views/index.rocker.html index 98a659e..cc18d3b 100644 --- a/src/main/resources/views/index.rocker.html +++ b/src/main/resources/views/index.rocker.html @@ -1,4 +1,5 @@ @import space.anity.DatabaseController +@import space.anity.UserHandler @args (String username) @layout.template("Index", RockerContent.NONE, RockerContent.NONE) -> { @@ -8,6 +9,9 @@ <div> @if(username.length() > 0) { <a class="button" href="/user/logout">Logout</a> + @if((new UserHandler()).isAdmin(username)) { + <a class="button" href="/admin">Admin</a> + } } else if (!(new DatabaseController()).isSetup()) { <a class="button" href="/setup">Setup</a> } else { diff --git a/src/main/resources/views/register.rocker.html b/src/main/resources/views/register.rocker.html index af3d127..131f406 100644 --- a/src/main/resources/views/register.rocker.html +++ b/src/main/resources/views/register.rocker.html @@ -12,11 +12,11 @@ </div> <div> <label for="password">Password:</label> - <input id="password" name="password" required type="password"/> + <input autocomplete="off" autofocus id="password" name="password" required type="password"/> </div> <div> <label for="verifyPassword">Verify password:</label> - <input id="verifyPassword" name="verifyPassword" required type="password"/> + <input autocomplete="off" id="verifyPassword" name="verifyPassword" required type="password"/> </div> <div> |