@page "/authorization"
@inherits APageComponent
@{try{
<!--=============================================================================================-->
@if (Session.IsOpen)
{
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
/*
// Rendering error test:
try {
   throw new ApplicationException( "Test error #1 has been thrown." );
}
catch (Exception e) {
   throw new ApplicationException( "Test error #2 has been thrown.", e );
}
*/
<div>
   <table id="pg_authorization_UserRequisitesTable" class="line_height_1">
      <tbody>
         <tr>
            <td><u>Login-name</u></td>@ColumnTD
            <td><b>@USR.LoginName</b>@if (@USR.IsAdministrator){
               <span class="faint_text"> (administrator)</span>}
            </td>
         </tr>
         <tr>
            <td style="height: 3px"></td>
         </tr>
         <tr>
            <td>Initials</td>@ColumnTD
            <td><b>@USR.Initials</b></td>
         </tr>
         <tr>
            <td>Last name</td>@ColumnTD
            <td><b><i>@USR.LastName</i></b></td>
         </tr>
         <tr>
            <td>First name</td>@ColumnTD
            <td><b><i>@USR.FirstName</i></b></td>
         </tr>
         <tr>
            <td>Second name</td>@ColumnTD
            <td><b><i>@USR.SecondName</i></b></td>
         </tr>
      </tbody>
   </table>
   <p class="littleSpacingP">
      Logged-in: <b>@Session.LoginTime</b> <span class="faint_text">(loc.)</span><br>
      Registration date: <b>@USR.RegistrationDate().ToShortDateString()</b>
   </p>
</div>
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
}
else // !Session.IsOpen:
{
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<div id="pg_authorization_UNPFrameDIV">
   <p class="page_ImpressiveTitle">
      Authorization (log-in to <b>BookRegistry</b>-service):
   </p>
   <table>
      <tbody>
         <tr>
            <td class="page_ActiveLabel"><u>U</u>ser name:</td>
            <td>&nbsp;</td>
            <td>
               <AEditBox @ref=@UserNameEdit
                         InputClasses_0="form-control"
                         Placeholder="your login-name"
                         Title="Input here your login-name" AccessKey="u"
                         InputValidationCallback=@UserName_Validate
                         ON_Input=@EditBox_OnInput
                         ON_KeyDown=@EditBox_OnKeyDown />
            </td>
            <td><AResetControl @ref=@ResetControl_UserName /></td>
         </tr>
         <tr><td></td></tr>
         <tr>
            <td class="page_ActiveLabel"><u>P</u>assword:</td>
            <td></td>
            <td>
               <AEditBox @ref=@PasswordEdit IsPasswordEditor=@true
                         InputClasses_0="form-control"
                         Placeholder="your password"
                         Title="Input here your password" AccessKey="p"
                         InputValidationCallback=@Password_Validate
                         ON_Input=@EditBox_OnInput
                         ON_KeyDown=@EditBox_OnKeyDown />
            </td>
            <td><AResetControl @ref=@ResetControl_Password /></td>
         </tr>
         <tr>
            <td colspan="3" style="text-align: right">
               <AButton @ref=@SubmitButton ID="pg_authorization_OpenSessionBUTTON"
                        Classes_0="btn btn-primary" Title="Query access to the service"
                        Enabled=@IsSubmissionEnabled AccessKey="o"
                        ON_Click_A=@SubmitButton_OnClick_A><u>O</u>pen session</AButton>
            </td>
         </tr>
      </tbody>
   </table>
   <AErrorList @ref=@ErrorList ULClasses="page_InputErrorUL" SpanClasses="page_InputErrorSPAN" />
   <div class="faint_text">
      /*<br>
      <AHRef HRef=@KnownUserHRef_1 Title=@KnownUserInsertTitle_1 Focusable=@false
             ON_Click=@(() => KnownUserA_OnClick(@KnownUser_1,@Password_1))><b>1</b></AHRef>)
         User: <span class="pg_authorization_TextSelectionSPAN" onclick="Element_SelectAll(this)">@KnownUser_1</span>;
         password: <span class="pg_authorization_TextSelectionSPAN" onclick="Element_SelectAll(this)">@Password_1</span><br>
      <AHRef HRef=@KnownUserHRef_2 Title=@KnownUserInsertTitle_2 Focusable=@false
             ON_Click=@(() => KnownUserA_OnClick(@KnownUser_2,@Password_2))><b>2</b></AHRef>)
         User: <span class="pg_authorization_TextSelectionSPAN" onclick="Element_SelectAll(this)">@KnownUser_2</span>;
         password: <span class="pg_authorization_TextSelectionSPAN" onclick="Element_SelectAll(this)">@Password_2</span><br>
      <AHRef HRef=@KnownUserHRef_3 Title=@KnownUserInsertTitle_3 Focusable=@false
             ON_Click=@(() => KnownUserA_OnClick(@KnownUser_3,@Password_3))><b>3</b></AHRef>)
         User: <span class="pg_authorization_TextSelectionSPAN" onclick="Element_SelectAll(this)">@KnownUser_3</span>;
         password: <span class="pg_authorization_TextSelectionSPAN" onclick="Element_SelectAll(this)">@Password_3</span> (administrator)<br>
      <AHRef HRef=@KnownUserHRef_4 Title=@KnownUserInsertTitle_4 Focusable=@false
             ON_Click=@(() => KnownUserA_OnClick(@KnownUser_4,@Password_4))><b>4</b></AHRef>)
         User: <span class="pg_authorization_TextSelectionSPAN" onclick="Element_SelectAll(this)">@KnownUser_4</span>;
         password: <span class="pg_authorization_TextSelectionSPAN" onclick="Element_SelectAll(this)">@Password_4</span> (administrator)<br>
      */
   </div>
</div><!--pg_authorization_UNPFrameDIV-->
<br><br>
<i>
   Power users (with <b>$</b>-name-prefix) are authenticated by MSSQL-procedure (as SQL-Server users).
</i>
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
} <!--!Session.IsOpen-->
<!--=============================================================================================-->
}catch(Exception e){ProcessRenderingError(GetType(),e);}}
