<!DOCTYPE html>
<html>
    <head>
        <title>User management</title>

        <link rel="stylesheet" text="text/css" href="/static/style.css">
    </head>
    <body>
        <div>
            <div class="content-box">
                <h1>User management</h1>

                <div style="text-align: right">
                    <a href="../v1/session/logout">Logout</a>
                </div>

                <form action="update" method="POST">
                    <table class="content-table" style="table-layout: auto">
                        {{ #each error_msg }}
                            <tr>
                                <td colspan="3">
                                    <div class="error-msg">{{ this }}</div>
                                </td>
                            </tr>
                        {{ /each }}
                        {{ #each info_msg }}
                            <tr>
                                <td colspan="3">
                                    <div class="info-msg">{{ this }}</div>
                                </td>
                            </tr>
                        {{ /each }}
                        <tr>
                            <td>Logged in as:</td>
                            <td>{{ username }}</td>
                        </tr>
                        <tr><td>&nbsp;</td></tr>
                        <tr><td colspan="3"><small>In order to make changes, you must authenticate with your current password.</small></td></tr>
                        <tr><td>&nbsp;</td></tr>
                        <tr>
                            <td>Current password:</td>
                            <td><input type="password" name="current_password" /></td>
                        </tr>
                        <tr><td>&nbsp;</td></tr>
                        <tr>
                            <td>New password:</td>
                            <td><input type="password" name="new_password" /></td>
                        </tr>
                        <tr>
                            <td>New password (again):</td>
                            <td><input type="password" name="new_password_repeated" /></td>
                        </tr>
                        <tr><td>&nbsp;</td></tr>
                        <tr>
                            <td>
                                TOTP control:
                            </td>
                            <td>
                                <select name="totp_control">
                                    {{ #each totp_control }}
                                        <option value="{{ value }}">{{ text }}</option>
                                    {{ /each }}
                                </input>
                            </td>
                        </tr>
                        <tr><td>&nbsp;</td></tr>
                        <tr>
                            <td colspan="3" style="text-align: center"><input type="submit" value="Update" /></td>
                        </tr>
                    </table>
                </form>
            </div>
            <div class="footer">
                Copyright &copy; Kestrel 2023. Released under the terms of the 4-clause BSD license.
            </div>
        </div>
    </body>
</html>