{{define "body"}}
{{if .Data}}
<div class="row">
    <div class="col-xs-4 offset-4">
        <div class="card border-primary mx-auto">
        <div class="card-header">
            <strong>{{.BodyTitle}}</strong>
            {{if .Data.Secret}}
            <a href="/user/totp/{{.Data.Username}}" class="btn btn-sm btn-danger float-right">Disable TOTP</a>
            {{else}}
            <a href="/user/totp/{{.Data.Username}}" class="btn btn-sm btn-success float-right">Enable TOTP</a>
            {{end}}
        </div>
        <div class="card-body">
            <form class="form-horizontal" action="/user/edit/{{.Data.Username}}" method="post">
                <input type="hidden" name="token" value="{{.Token}}">
                <div class="form-group">
                    <label class="col-form-label" for="user">Username</label>
                    <input class="form-control input-sm" type="text" id="user" name="user" value="{{.Data.Username}}" disabled>
                </div>
                <div class="form-group">
                    <label class="col-form-label" for="password">Password</label>
                    <input class="form-control input-sm" type="password" id="password" name="password" autofocus>
                </div>
                <div class="form-group">
                    <label class="col-form-label" for="repeat">Repeat</label>
                    <input class="form-control input-sm" type="password" id="repeat" name="repeat">
                </div>
                {{if .Admin}}
                <div class="form-group">
                    <div class="custom-control custom-checkbox">
                        {{if .Data.Admin}}
                        <input type="checkbox" class="custom-control-input" id="admin" name="admin" value="0" checked>
                        {{else}}
                        <input type="checkbox" class="custom-control-input" id="admin" name="admin" value="0">
                        {{end}}
                        <label class="custom-control-label" for="admin">Admin Privileges</label>
                    </div>
                </div>
                {{end}}
                <button class="btn btn-sm btn-primary" type="submit">Update</button>
                {{if .Admin}}
                <a href="/users" class="btn btn-sm btn-primary">Back</a>
                {{else}}
                <a href="/" class="btn btn-sm btn-primary">Back</a>
                {{end}}
                <a class="btn btn-sm btn-danger" href="/user/del/{{.Data.Username}}">Delete</a>
            </form>
            {{if .Admin}}
            {{if eq .Data.Locked 3}}
            <form class="form-horizontal" action="/user/unlock/{{.Data.Username}}" method="post">
                <input type="hidden" name="token" value="{{.Token}}">
                <div class="form-group">
                    <label class="col-form-label" for="unlock">Locked</label>
                    <button class="btn btn-sm btn-warning" type="submit" id="unlock">Unlock</button>
                </div>
            </form>
            {{end}}
            {{end}}
        </div>
        </div>
    </div>
</div>
{{end}}
{{end}}
