<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Create.aspx.cs" Inherits="eDocument.Server.Administrator.User.Create" MasterPageFile="~/Site.Master" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="Server">

    <div class="row">
        <div class="col-12 col-lg-6 offset-lg-3">
            <h1 class="skjema-admin__page-title skjema-admin__text-center d-block">
                Opprett bruker
            </h1>

            <asp:Panel runat="server" ID="registerUserPanel">
                <div>
                    <div class="skjema-admin__mb-20">
                        <label class="skjema-admin__page__label">
                            Ditt navn
                            <asp:RequiredFieldValidator runat="server" ControlToValidate="txtDisplayName" Display="Dynamic" ForeColor="Red">*</asp:RequiredFieldValidator>
                        </label>

                        <asp:TextBox 
                            ID="txtDisplayName" 
                            runat="server" 
                            CssClass="skjema-admin__form__input"
                            MaxLength="300">
                        </asp:TextBox>
                    </div>

                    <div class="skjema-admin__mb-20">
                        <label class="skjema-admin__page__label">
                            E-postadresse (brukernavn)
                            <asp:RequiredFieldValidator runat="server" ControlToValidate="txtEmail" ForeColor="Red" Display="Dynamic">*</asp:RequiredFieldValidator>
                        </label>

                        <asp:TextBox 
                            ID="txtEmail" 
                            CssClass="skjema-admin__form__input"
                            runat="server" 
                            MaxLength="300">
                        </asp:TextBox>
                
                        <asp:RegularExpressionValidator runat="server" ControlToValidate="txtEmail" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" Display="Dynamic" ErrorMessage="Ugyldig e-postadresse" ForeColor="Red" />
                        <asp:Label runat="server" ID="lblEmail" ForeColor="Red"></asp:Label>
                    </div>

                    <div class="skjema-admin__mb-20">
                        <label class="skjema-admin__page__label">
                            Passord
                            <asp:RequiredFieldValidator runat="server" ControlToValidate="txtPassword" Display="Dynamic" ForeColor="Red">*</asp:RequiredFieldValidator>
                        </label>

                        <asp:TextBox 
                            ID="txtPassword" 
                            CssClass="skjema-admin__form__input mb-2"
                            TextMode="Password"
                            runat="server" 
                            MaxLength="300">
                        </asp:TextBox>

                        <p>
                            Må inneholde minst seks tegn - og minst én stor bokstav, minst én liten bokstav og ett tall eller spesialtegn.
                        </p>

                        <asp:RegularExpressionValidator runat="server" ControlToValidate="txtPassword" Display="Dynamic" ForeColor="Red" ValidationExpression="(?=^.{6,}$)((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$">Minst seks tegn, hvorav minst 1 stor bokstav, minst 1 liten bokstav og minst 1 tall/spesialtegn</asp:RegularExpressionValidator>
                    </div>

                    <div class="skjema-admin__mb-20">

                        <label class="skjema-admin__page__label">
                            Gjenta passord
                        </label>

                        <asp:TextBox 
                            ID="txtPasswordRepeat"
                            CssClass="skjema-admin__form__input mb-2"
                            TextMode="Password" 
                            runat="server" 
                            MaxLength="300">
                        </asp:TextBox>

                        <asp:CompareValidator runat="server" ControlToValidate="txtPasswordRepeat" ControlToCompare="txtPassword" Operator="Equal" Type="String" ErrorMessage="Passordene er ikke like." ForeColor="Red" /><br />
                        <asp:Label runat="server" ID="lblPasswordError" ForeColor="Red"></asp:Label>
                    </div>
                </div>

                <asp:Button 
                    ID="btnCreate" 
                    CssClass="skjema-admin__button skjema-admin__button--primary mb-5"
                    runat="server" 
                    Text="Opprett bruker" 
                    OnClick="btnCreate_Click">
                </asp:Button>

                <asp:Label runat="server" ID="lblMessage" ForeColor="Red"></asp:Label>
            </asp:Panel>

            <a href="Login.aspx">Avbryt</a>
        </div>
    </div>

</asp:Content>
