{{/*
This file is part of SystemTestPortal.
Copyright (C) 2017  Institute of Software Technology, University of Stuttgart

SystemTestPortal is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

SystemTestPortal is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with SystemTestPortal.  If not, see <http://www.gnu.org/licenses/>.
*/}}

{{define "content"}}

<div class="card p-5">
    <form id="newUserForm" action="/register">
        <div id="modalPlaceholder"></div>
    {{if .User}}
        <h3>{{ T "Create new User" .}}</h3>
        <p>{{ T "Please provide some information to register a new user." .}}</p>
    {{else}}
        <h3>{{ T "Register" .}}</h3>
        <p>{{ T "Please provide some information to register yourself." .}}</p>
    {{end}}
        <div class="form-group row">
            <label class="col-sm-2 col-form-label" for="inputUserName">User name</label>
            <div class="col-sm-10">
                <input class="form-control" id="inputUserName" name="inputUserName"
                       aria-describedby="userNameHelp" placeholder="eg. 'musterma'">
                <small id="userNameHelp" class="form-text text-muted">
                    {{ T "This name is used for signin, urls and mentioning. It must not contain any blank spaces or special characters." .}}
                </small>
            </div>
        </div>
        <div class="form-group row">
            <label class="col-sm-2 col-form-label" for="inputDisplayName">Display name</label>
            <div class="col-sm-10">
                <input class="form-control" id="inputDisplayName" name="inputDisplayName"
                       aria-describedby="displayNameHelp" placeholder="eg. 'Max Mustermann'">
                <small id="displayNameHelp" class="form-text text-muted">
                    {{ T "This name is used to display your contribution." .}}
                </small>
            </div>
        </div>
        <div class="form-group row">
            <label class="col-sm-2 col-form-label" for="inputEmail">Email address</label>
            <div class="col-sm-10">
                <input type="email" class="form-control" id="inputEmail" name="inputEmail"
                       aria-describedby="emailHelp" placeholder="eg. 'musterma@example.com'">
                <small id="emailHelp" class="form-text text-muted">
                    {{ T "This email address is used for verification and notifications." .}}
                </small>
            </div>
        </div>
        <div class="form-group row">
            <label class="col-sm-2 col-form-label" for="inputPassword1">Password</label>
            <div class="col-sm-10">
                <input type="password" class="form-control" id="inputPassword1" name="inputPassword"
                       aria-describedby="passwordHelp" placeholder="">
                <small id="passwordHelp" class="form-text text-muted">
                    {{ T "Enter a password with at least 8 characters." .}}
                </small>
            </div>
        </div>
        <div class="form-group row">
            <div class="col-sm-10 ml-auto">
                <input type="password" class="form-control" id="inputPasswordRepeat1" name="inputPasswordRepeat"
                       aria-describedby="passwordRepeatHelp" placeholder="">
                <small id="passwordRepeatHelp" class="form-text text-muted">
                    {{ T "Repeat your password." .}}
                </small>
            </div>
        </div>

    {{if .SignedIn }}
    {{ if .User.IsAdmin}}
        <div class="form-group row">
            <label class="col-sm-2 col-form-label" for="inputPassword1">Admin permissions</label>
            <div class="col-sm-10">
                <input type="checkbox" id="inputIsAdmin" name="inputIsAdmin"
                       aria-describedby="adminPermissionHelp">
                <small id="adminPermissionHelp" class="form-text text-muted">
                    {{ T "This checkbox gives the registered user system wide admin permissions, if checked." .}}
                </small>
            </div>
        </div>
    {{end}}
    {{end}}

        <div class="form-group row">
            <div class="col-sm-10 ml-auto">
                <button class="btn btn-primary" id="registerButton">{{ T "Register" .}}</button>
            </div>
        </div>
    </form>
</div>

<!-- Import Scripts here -->
<script src="/static/assets/js/vendor/jquery.validate.min.js"></script>
<script src="/static/js/misc/register.js"></script>
{{end}}


