% layout 'AdminLTE', title => "User password";

% content_for 'module' => begin

<div class="card-body">

    % if (config->{debug} == 0) {
        <pre>
            <%= dumper $c->current_route %>
            <%= dumper $pwd_datas %>
        </pre>
    % }

    <h2><%= l 'pwd_ACCOUNT_PASSWORD_CHANGE' %></h2>

    % if ( stash 'error' ) {
        <br>
        <div CLASS="text-danvgr">
            <%= $c->render_to_string(inline => stash 'error') %>
        </div>
    % }


    % my $btn = l('pwd_PASSWORD_CHANGE');
    % my $url = '/userpassword';

    <div>
        <%= $c->render_to_string( inline => l('pwd_DESCRIPTION')); %>
    </div>

    <div>
        % my $strength = uc($pwd_datas->{passwdstrength});
        <%= $c->render_to_string( inline => l('pwd_'.$strength.'_PASSWORD_DESCRIPTION',$pwd_datas->{passwdlength})) %>
        <br />
        <%= $c->render_to_string( inline => l('pwd_PASSWORD_WIKI')) %>
    </div>


    % if ( $pwd_datas->{trt} eq 'RESET' ) {
        % my $btn = l('pwd_PASSWORD_RESET');
        % my $url = '/userpasswordr';
        <%= $c->render_to_string( inline => l('pwd_DESCRIPTION_RESET')); %>
    % }

   <br>


    <!-- Start of Form -->

    <form action="smanager/userpassword" method="POST">

        <div class="row g-3 align-items-center">
            <div class="col-md-1">
                <label for="YourAccount" class="col-form-label"><%= l 'pwd_YOUR_ACCOUNT' %></label>
            </div>
            <div class="col-auto">
                <input type="text" name="Account" id="YourAccount" class="form-control-plaintext" value="<%= $pwd_datas->{Account} %>" readonly>
            </div>
        </div>

        <br>

        % if ( $pwd_datas->{trt} ne 'RESET' ) {
            <div class="row g-3 align-items-center">
                <div class="col-md-1">
                    <label for="OldPass" class="col-form-label"><%= l 'pwd_PASSWORD_OLD' %></label>
                </div>
                <div class="col-auto">
                    <input name="OldPass" type="password" id="OldPass" class="form-control" placeholder="Old Password">
                </div>
                <div class="col-auto">
                    <span id="togglePasswordVerify" class="bi bi-eye"></span>
                </div>
            </div>
            <br>
        % }

        <div class="row g-3 align-items-center">
            <div class="col-md-1">
                <label for="Pass" class="col-form-label"><%= l 'pwd_PASSWORD_NEW' %></label>
            </div>
            <div class="col-auto">
                <input name="Pass" type="password" id="Pass" class="form-control" placeholder="New Password">
            </div>
            <div class="col-auto">
                <span id="togglePasswordVerify" class="bi bi-eye"></span>
            </div>
        </div>

        <br>

        <div class="row g-3 align-items-center sme-password">
            <div class="col-md-1">
                <label for="PassVerify" class="col-form-label"><%=l 'pwd_PASSWORD_VERIFY_NEW' %></label>
            </div>
            <div class="col-auto">
                <input name="Passverify" type="password" id="PassVerify" class="form-control" placeholder="Verify Password">
            </div>
            <div class="col-auto">
                <span id="togglePassword" class="bi bi-eye"></span>
            </div>
        </div>

        <br>

        <div>
        Show All Passwords Test
            <span id="togglePasswords" class="bi bi-eye"></span>
        </div>

        <br>

        <%= hidden_field 'User' => $pwd_datas->{Account} %>
        <%= hidden_field 'Trt' => $pwd_datas->{trt} %>
        <%= hidden_field 'jwt' => $pwd_datas->{jwt} %>

        <div class="row g-3 align-items-center">
            <div class="col-md-1">
                <button type="submit" class="btn btn-primary btn-sm"><%= $btn %></button>
            </div>
        </div>

    </form>
    <!-- End of Form -->

</div>

% end