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

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" Runat="Server">
    <div class="d-flex flex-column align-items-center">
        <div style="width:460px;">
            <h1
                id="title"
                class="skjema-admin__page-title text-center"
                runat="server">
                Logg inn
            </h1>

            <div class="skjema-admin__page__field" id="divVault" runat="server" Visible="False">
                <label class="skjema-admin__page__label skjema-admin__page__label--thin" for="UserName">
                    Du er i ferd med å utføre en administrativ oppgave som krever at du bekrefter ditt brukernavn/passord.
                </label>
            </div>

            <div id="divUsernameAndPassword" runat="server">
                <div class="skjema-admin__page__field">
                    <label class="skjema-admin__page__label skjema-admin__page__label--thin" for="UserName">
                        E-post (brukernavn)
                    </label>

                    <asp:TextBox 
                        ID="UserName" 
                        CssClass="skjema-admin__page__text skjema-admin__page__text--primary-border"
                        runat="server">
                    </asp:TextBox>
                </div>

                <div class="skjema-admin__page__field">
                    <label class="skjema-admin__page__label skjema-admin__page__label--thin" for="Password">
                        Passord
                    </label>

                    <asp:TextBox 
                        CssClass="skjema-admin__page__text skjema-admin__page__text--primary-border mb-3"
                        ID="Password" 
                        runat="server" 
                        TextMode="Password">
                    </asp:TextBox>

                    <asp:Label 
                        ID="InvalidCredentialsMessage" 
                        runat="server" 
                        ForeColor="Red" 
                        Text="Ditt brukernavn eller passord er feil. Vennligst prøv igjen."
                        Display="Dynamic"
                        Visible="False">
                    </asp:Label>

                    <div>
                        <asp:Label runat="server" id="lblMessage" ForeColor="Red"></asp:Label>
                    </div>

                    <div class="mb-4">
                        <asp:LinkButton 
                            ID="lnkForgottenPassword2"
                            runat="server" 
                            Text="Glemt brukernavn/passord" 
                            OnClick="lnkForgottenPassword_OnClick"
                            NavigateUrl="~/User/ForgottenPassword.aspx" /> 
                    </div>
                    
                    <asp:Label runat="server" id="lblForgottenPassword"></asp:Label>

                    <div runat="server" Visible="False">
                        <asp:CheckBox 
                            CssClass="skjema-admin__page__tick"
                            ID="RememberMe" 
                            runat="server" 
                            Text="Husk meg" /> 
                    </div>
                </div>
            
                <div class="text-center">
                    <asp:Button 
                        ID="LoginButton" 
                        runat="server" 
                        Text="Logg inn"
                        Style="width:216px"
                        CssClass="skjema-admin__button skjema-admin__button--primary text-center"
                        OnClick="LoginButton_Click" /> 
                </div>
            </div>
            <div id="twoFactorAuth" runat="server" Visible="False">
                <asp:TextBox ID="txtTwoFactorCode" 
                             runat="server" 
                             CssClass="skjema-admin__page__text skjema-admin__page__text--primary-border mb-3" 
                             placeholder="Skriv inn to-faktorkode fra autentiseringsapp" 
                             Visible="false" />
                <asp:Label ID="lblTwoFactorError" runat="server" 
                           ForeColor="Red" 
                           Visible="false" 
                           Text="Feil to-faktorkode!">

                </asp:Label>
                <div class="text-center">
                    <asp:Button 
                        ID="Login2Fac" 
                        runat="server" 
                        Text="Logg inn"
                        Style="width:216px"
                        CssClass="skjema-admin__button skjema-admin__button--primary text-center"
                        OnClick="Login2Fac_Click" /> 
                </div>
            </div>
            <hr class="skjema-admin__hr__login" />
        
            <div id="divAzureAd" runat="server" Visible="False">
                <div class="text-center">
                    <asp:Button 
                        ID="LoginAzureAdButton" 
                        runat="server" 
                        Text="Logg inn Azure AD"
                        Style="width:200px"
                        CssClass="skjema-admin__button skjema-admin__button--primary text-center"
                        OnClick="LoginAzureAdButton_Click" /> 
                </div>
            </div>
        </div>
        
        <div id="divNotRegistered" runat="server">
            <hr class="skjema-admin__hr__login" />

            <div id="divCreateUser" runat="server">
                <div class="text-center mb-3">
                    Ikke registrert?
                </div>

                <asp:HyperLink 
                    ID="opprettBruker" 
                    CssClass="skjema-admin__button skjema-admin__button--secondary d-inline-block text-center"
                    runat="server" 
                    Style="width:216px"
                    Text="Opprett bruker" 
                NavigateUrl="~/User/Create.aspx" />
            </div>
        </div>
    </div>
</asp:Content>