  <!-- start 2FA Verification modal -->

  <!-- 2FA Verification modal end -->
  <!-- BEGIN DIALOGS -->
  <!-- Google Verificatio Modal content Start-->
  <div id="sn-verification-modal" class="modal fade google-verification-modal" role="dialog">
    <div class="modal-dialog">
      <!-- Modal content-->
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close google-verification-close" data-dismiss="modal">×</button>
          <h4 class="modal-title">
            İki Aşamalı Güvenlik
          </h4>
        </div>
        <div class="modal-body">
          <div class="row">
            <div class="col-md-12">
              <div class="twofa_text text-danger text-center mb-4 UserSecureWordTxt_Container"></div>
              <div class="form-horizontal">
                <div class="form-group" validationcontainer="verification">
                  <input type="hidden" name="pin" class="form-control" />
                  <div class="col-sm-12 sn-valid-check">
                    <p id="verification_code_message" style="color: #ca0909;"></p>
                    <input type="text" name="verification_code" class="form-control"
                      placeholder="Lütfen onay kodunu giriniz" />
                  </div>
                  <div class="error2 col-sm-offset-4"></div>
                </div>
              </div>
            </div>
          </div>
          <div class="row">
            <div class="col-xs-6">
              <button type="submit" class="btn btn-primary" id="verification_submit" style="width: 100%;">
                Gönder
              </button>
            </div>
            <div class="col-xs-6">
              <button type="button" class="btn btn-warning" id="verification_cancel" data-dismiss="modal"
                style="width: 100%;">
                İptal
              </button>
            </div>
          </div>

          <div class="clear"></div>
        </div>
        <div class="modal-footer">
          <div class="row"></div>
        </div>
      </div>
    </div>
  </div>
  <!-- Google Verificatio Modal content End-->

  <div id="sn_sms_2fa_modal" class="modal fade sms-verification-modal" role="dialog">
    <div class="modal-dialog modal_twofa">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close sms-verification-modal-close" data-dismiss="modal">×</button>
          <h4 class="modal-title">
            SMS Doğrulama
          </h4>
        </div>

        <div class="modal-body">
          <div class="twofa_text text-success" id="auth_sms_2fa_success_info"><i class="fa fa-check-circle"></i>&nbsp;
            SMS Kodu cep telefonunuza gönderildi.</div>

          <div class="twofa_text text-danger text-center mb-4 UserSecureWordTxt_Container"></div>
          <div class="row twofa_sms_code sms-verification-modal-code">
            <div class="col-sm-4 text-right">
              <label>Telefon Numaranız</label>
            </div>
            <div class="col-sm-6 verification-input-moth">
              <input type="text" class="form-control" id="user_mobile_for_sms_auth" readonly="" />
            </div>
          </div>

          <div class="row twofa_sms_code sms-verification-modal-code">
            <div class="col-sm-4 text-right">
              <label>SMS Kodu</label>
            </div>
            <div class="col-sm-6 verification-input-moth">
              <input type="text" placeholder="Kodu girin" class="form-control" id="sms_2fa_code_input" />
              <div class="col-sm-2">
                <span id="auth_sms_2fa_timer" data-ready="1" class="sms-verification-timer">00:30</span>
              </div>
              <div class="error2" style="padding-left: 0; max-width: inherit; color: #e9a025;"
                id="auth_sms_2fa_error_info"></div>
            </div>
          </div>
        </div>

        <div class="modal-footer">
          <div class="row">
            <div class="col-xs-6">
              <div class="sn-loginbut text-left">
                <span class="foottext">
                  SMS Ulaşmadı mı?
                  <a target="_blank" class="sms-confirm-auth-code" onclick="SendAuthSmsCode(); return false;">Tekrar
                    Gönder</a>
                </span>
              </div>
            </div>
            <div class="col-xs-6">
              <div class="sn-loginbut text-right">
                <input type="button" class="btn btn-primary" onclick="confirmAuthSmsCode(); return false;"
                  value="Onayla" />
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>

  <!-- /.register modal end -->
<?php if (isset($_SESSION['showSn1Modal'])): ?>
    <!-- LOGIN OLDUKTAN SONRA ÇIKACAK -->
    <div id="sn-modal-1" class="modal sn-modal-1" role="dialog" style="display: block;">
    <div class="modal-dialog modal-lg modal-dialog-centered">
      <div class="modal-content">
        <div class="modal-body p-0">
          <button type="button" class="btn-close btn-close1" data-bs-dismiss="modal"></button>

          <input type="hidden" id="tt" value="1987" />

          <div class="row">
            <div class="col-md-12">
              <div class="form-horizontal sn-modal-1-message-text">
                <p><img style="width: 100%;" src="https://i.ibb.co/7NHzFGj/Web-Popup.webp" /></p>
              </div>
            </div>
          </div>

          <div class="clear"></div>
        </div>
        <div class="modal-footer sn__modal">
          <div class="row w-100">
            <div class="col-xs-12">
              <div class="d-flex justify-content-between align-items-center">
                <label><input type="checkbox" id="sn-modal-1-dontshow" value="" />&nbsp; Bu mesajı bir daha gösterme</label>
                <input type="button" class="btn btn-primary" data-dismiss="modal" id="sn-modal-1-ok" value="Onay" />
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
<?php endif; ?>
<!-- heaedr comes -->
<?php if (!isIncludingURL('/LogOn')): ?>
       <div class="modal fade login-modal" id="login-modal" tabindex="-1" role="dialog"
      aria-labelledby="exampleModalLongTitle" aria-hidden="true">
      <div class="modal-dialog modal-dialog-centered">
        <div class="modal-content">
          <div class="row">
            <button type="button" class="btn-close btn-close1" data-bs-dismiss="modal" aria-label="Close"></button>
            <div class="col-12 col-md-8">
              <div class="modal-header">
                <h5 class="modal-title" id="exampleModalLabel"><img src="/Content/img/new-Sekabet-Logo.png" alt=""
                    style="width: 135px;" /></h5>
              </div>
              <div class="modal-login">
                <form action="/tr/Security/LogOn" method="post" autocomplete="off" name="login_form" id="login_form"
                  style="display: inline;">
                  <p class="login-welcome">Hoş geldiniz!</p>
                  <p class="login-account">Henüz bir hesabınız yok mu? <a href="/tr/Security/Register">Şimdi kayıt ol
                    </a></p>
                  <div class="input-group">
                    <div class="recovery_pass__phone-pre" id="login__recovery_pass__phone-pre1" style="display: none;">
                      <div class="iti-flag tr"></div>
                      <p class="plus">+</p>
                    </div>
                    <!-- <input type="text" class="login-input login-input__mobileNumber" id="inputplaceholderid1"
                      placeholder="Cep Telefonu" name="MobileNumber" style="display: none;" /> -->
                    <input type="text" class="login-input login-input__userName" id="inputplaceholderid1"
                      placeholder="E-Posta yada Kullanıcı Adı" name="UserName" />
                    <button type="button" class="switchbutton" id="ToggleLogin1"
                      style="position: absolute; margin-top: 13px; right: 8px; border: none; color: white; outline: none; background: transparent;">
                      <span class="fa fa-phone" id="phone-span1" title="Cep Telefonu"> </span>
                    </button>
                  </div>
                  <div class="input-group">
                    <input type="password" class="login-input mt-3" placeholder="Şifre" name="Password"
                      id="login-password" />

                    <span class="fa fa-eye-slash" style="font-size: 20px;" id="showpassword" title="show"></span>
                  </div>
                  <input type="hidden" name="returnUrl" />
                  <input type="hidden" value="" id="ipx" name="ip" />
                  <input type="hidden" value="" id="pinx" name="pinx" />
                  <input type="hidden" value="" id="smsCodex" name="smsCodex" />
                  <div class="login-btn">
                    <div>
                      <div class="grecaptcha-badge" data-style="none"
                        style="width: 256px; height: 60px; position: fixed; visibility: hidden;">
                        <div class="grecaptcha-logo">
                          <iframe title="reCAPTCHA" width="256" height="60" role="presentation" name="a-vj74i95aelv8"
                            frameborder="0" scrolling="no"
                            sandbox="allow-forms allow-popups allow-same-origin allow-scripts allow-top-navigation allow-modals allow-popups-to-escape-sandbox allow-storage-access-by-user-activation"
                            src="https://www.google.com/recaptcha/enterprise/anchor?ar=1&amp;k=6Ld4Aw8nAAAAAHOFGczM6ah8kzROMxZaF5a6oHkA&amp;co=aHR0cHM6Ly9zZWthYmV0MTIxNi5jb206NDQz&amp;hl=tr&amp;v=Xv-KF0LlBu_a0FJ9I5YSlX5m&amp;size=invisible&amp;sa=submit&amp;cb=rmcdg0o4edm9"></iframe>
                        </div>
                        <div class="grecaptcha-error"></div>
                        <textarea id="g-recaptcha-response" name="g-recaptcha-response" class="g-recaptcha-response"
                          style="width: 250px; height: 40px; border: 1px solid rgb(193, 193, 193); margin: 10px 25px; padding: 0px; resize: none; display: none;"></textarea>
                      </div>
                      <iframe style="display: none;"></iframe>
                    </div>
                    <button class="btn btn-primary g-recaptcha" type="submit" id="login-modal__submit"
                      data-sitekey="6Ld4Aw8nAAAAAHOFGczM6ah8kzROMxZaF5a6oHkA" data-callback="onSubmit"
                      data-action="submit">
                      Giriş
                    </button>
                    <a href="#" data-bs-toggle="modal" data-bs-target="#sn_password_recovery_modal">Şifremi Unuttum</a>
                  </div>

                  <p class="recaptcha-info-text">
                    Sekabet, reCAPTCHA tarafından korunmaktadır ve Google
                    <a href="https://policies.google.com/privacy" class="text-primary">Gizlilik Politikası</a> ve <a
                      href="https://policies.google.com/terms" class="text-primary">Hizmet Koşulları</a>’na tabidir.
                  </p>
                </form>
              </div>
            </div>
            <div class="col-4 d-none d-md-block"></div>
          </div>
        </div>
      </div>
    </div>
  <?php endif; ?>
    <!--.register modal start -->
    <script>
      var count = 0;
      function onSubmit(token) {
        alert('triggered onSubmit')
        onLogon();
      }

      $(document).ready(function () {
        $("#login-password").keyup(function (e) {
          e.preventDefault();
          if (e.key === "Enter") {
            $("#login-modal__submit").click();
          }
        });
      });

      // visibility of password
      $(document).ready(function () {
        /*const mobileNumberCode = $('.login-input__mobileNumber').val(90)*/
        $(".login-input__mobileNumber").keyup(function () {
          if (!$(this).val().startsWith(90)) {
            $("[name=UserName]").val(90 + $(this).val());
            $("[name=MobileNumber]").val(90 + $(this).val());
          } else {
            $("[name=UserName]").val($(this).val());
            $("[name=MobileNumber]").val($(this).val());
          }
        });

        $("#ToggleLogin1").click(function () {
          var phonespan = document.getElementById("phone-span1");
          var usernameinput = document.getElementById("inputplaceholderid1");
          count++;
          if (count % 2 != 0) {
            $(".login-input__mobileNumber").css("display", "block");
            $(".login-input__userName").css("display", "none");
            phonespan.classList.remove("fa-phone");
            phonespan.classList.add("fa-envelope");
            $("#login__recovery_pass__phone-pre1").show();
            usernameinput.style.paddingLeft = "51px";
          } else {
            $(".login-input__mobileNumber").css("display", "none");
            $(".login-input__userName").css("display", "block");
            phonespan.classList.remove("fa-envelope");
            phonespan.classList.add("fa-phone");
            $("#login__recovery_pass__phone-pre1").hide();
            usernameinput.style.paddingLeft = "16px";
          }
        });
      });
    </script>

    <script src="/Scripts/jquery.steps.js"></script>

    <div id="sn_password_recovery_modal" class="modal fade in custom-modal" role="dialog">
      <div class="modal-dialog modal-dialog-centered">
        <div class="modal-content block__container login__container">
          <div class="modal-header">
            <h4 class="modal-title">
              ŞİFREYİ SIFIRLA
            </h4>
            <button type="button" class="close" data-bs-dismiss="modal">×</button>
          </div>

          <div class="modal-body">
            <div class="block__title-bar login-page__title forgot--password__modal"></div>

            <div id="recovery_pass_steps" role="application" class="wizard clearfix">
              <div class="steps clearfix">
                <ul role="tablist" style="display: none;">
                  <li role="tab" class="first current" aria-disabled="false" aria-selected="true">
                    <a id="recovery_pass_steps-t-0" href="#recovery_pass_steps-h-0"
                      aria-controls="recovery_pass_steps-p-0"><span class="current-info audible">current step:
                      </span><span class="number">1.</span> ResetPassword</a>
                  </li>
                  <li role="tab" class="disabled" aria-disabled="true">
                    <a id="recovery_pass_steps-t-1" href="#recovery_pass_steps-h-1"
                      aria-controls="recovery_pass_steps-p-1"><span class="number">2.</span> ResetPassword</a>
                  </li>
                  <li role="tab" class="disabled" aria-disabled="true">
                    <a id="recovery_pass_steps-t-2" href="#recovery_pass_steps-h-2"
                      aria-controls="recovery_pass_steps-p-2"><span class="number">3.</span> ResetPassword</a>
                  </li>
                  <li role="tab" class="disabled last" aria-disabled="true">
                    <a id="recovery_pass_steps-t-3" href="#recovery_pass_steps-h-3"
                      aria-controls="recovery_pass_steps-p-3"><span class="number">4.</span> ResetPassword</a>
                  </li>
                </ul>
              </div>
              <div class="content clearfix">
                <h3 id="recovery_pass_steps-h-0" tabindex="-1" class="title current" style="display: none;">
                  ResetPassword</h3>

                <section class="login__content body current" id="recovery_pass_steps-p-0" role="tabpanel"
                  aria-labelledby="recovery_pass_steps-h-0" aria-hidden="false">
                  <div class="mb-4">
                    <i class="fa fa-info-circle me-1"></i>
                    <span>Lütfen geçerli bir telefon numarası ve kullanıcı adı giriniz</span>
                  </div>
                  <div class="form-group group-md" resetpasswordvalidationcontainer="phoneNumber">
                    <label class="login-label">Telefon Numaranız</label>
                    <div style="position: relative;">
                      <div class="recovery_pass__phone-pre">
                        <span>+90</span>
                      </div>
                      <input type="text" class="form-control" placeholder="" name="pass_reset_phoneNumber"
                        data-validated="0" style="padding-left: 75px;" />
                      <div class="error-text error2"></div>
                    </div>
                  </div>
                  <div class="form-group" resetpasswordvalidationcontainer="userName">
                    <label class="mb-2">Kullanıcı Adı</label>
                    <input type="text" class="form-control mb-2" placeholder="" name="pass_reset_userName"
                      data-validated="0" />
                    <div class="error-text error2"></div>
                  </div>
                </section>

                <h3 id="recovery_pass_steps-h-1" tabindex="-1" class="title" style="display: none;">ResetPassword</h3>

                <section class="login__content body" style="padding-bottom: 0px; display: none;"
                  id="recovery_pass_steps-p-1" role="tabpanel" aria-labelledby="recovery_pass_steps-h-1"
                  aria-hidden="true">
                  <div class="form-group group-md">
                    <label class="mb-2">Cep Telefonu</label>
                    <input type="text" value="+ *** ** ******" class="form-control" name="pass_reset_mobile"
                      disabled="" />
                  </div>

                  <div class="form-group group-lg" resetpasswordvalidationcontainer="smsCode">
                    <label class="mb-2">SMS Kodu</label>
                    <div class="sms-code__container">
                      <div class="sms-code__input-container">
                        <input type="text" class="form-control m-0" placeholder="Kodu girin" name="pass_reset_sms_code"
                          maxlength="8" data-validated="0" />
                        <span id="reset_pass_sms_timer" class="reset_pass_sms_timer">00:30</span>
                      </div>
                      <div class="sms-code__button-container">
                        <button id="pass_reset_send_code" class="btn btn-primary btn-block">
                          SMS Gönder
                        </button>
                      </div>
                    </div>
                    <div class="error-text error2"></div>
                  </div>
                </section>

                <h3 id="recovery_pass_steps-h-2" tabindex="-1" class="title" style="display: none;">ResetPassword</h3>

                <section class="login__content body" style="padding-bottom: 0px; display: none;"
                  id="recovery_pass_steps-p-2" role="tabpanel" aria-labelledby="recovery_pass_steps-h-2"
                  aria-hidden="true">
                  <div class="form-group group-md required" resetpasswordvalidationcontainer="password">
                    <label class="mb-2">Şifre</label>
                    <input type="password" placeholder="Yeni Şifre Girin" class="form-control"
                      name="pass_reset_new_password" data-validated="0" />
                    <div class="progress password__progress" resetpasswordvalidationcontainer="passProgress">
                      <div class="progress-bar progress-bar-danger progress-bar-20" role="progressbar"
                        style="width: 20%; display: none;"></div>
                      <div class="progress-bar progress-bar-warning progress-bar-50" role="progressbar"
                        style="width: 50%; display: none;"></div>
                      <div class="progress-bar progress-bar-success progress-bar-100" role="progressbar"
                        style="width: 100%; display: none;"></div>
                    </div>
                    <div class="error2 error-text" style="padding-left: 0; max-width: inherit;"></div>
                  </div>

                  <div class="form-group group-md" resetpasswordvalidationcontainer="confirmPassword">
                    <label class="mb-2">Şifreyi Onayla</label>
                    <div class="sms-code__container">
                      <input type="password" placeholder="Şifreyi Onayla" class="form-control"
                        name="pass_reset_confirm_new_password" data-validated="0" />
                    </div>
                    <div class="error-text error2"></div>
                  </div>
                </section>

                <h3 id="recovery_pass_steps-h-3" tabindex="-1" class="title" style="display: none;">ResetPassword</h3>
                <section id="recovery_pass_steps-p-3" role="tabpanel" aria-labelledby="recovery_pass_steps-h-3"
                  class="body" aria-hidden="true" style="display: none;">
                  <div class="text-success">
                    <i class="fa fa-check-circle me-2"></i>
                    Şifre kurtarma başarıyla tamamlandı!
                  </div>
                </section>
              </div>
            </div>
          </div>

          <div class="modal-footer">
            <div class="d-flex gap-2">
              <a class="btn btn-secondary btn-block" target="_blank" style="display: none;" id="pass_reset_back_step">
                Geri
              </a>

              <a type="submit" class="btn btn-primary btn-block" id="pass_reset_next_step">
                İleri
              </a>

              <input type="submit" class="btn btn-primary btn-block pass-reset-footer-action" id="pass_reset_submit"
                value="Gönder" style="display: none;" />
            </div>
          </div>
        </div>
      </div>
    </div>

    <script>
      (function () {
        var $sn_password_recovery_modal = $("#sn_password_recovery_modal");

        var $pass_reset_back_step = $("#pass_reset_back_step");
        var $pass_reset_next_step = $("#pass_reset_next_step");
        var $pass_reset_submit = $("#pass_reset_submit");

        var loader = $(".loader").dialog({
          autoOpen: false,
          modal: true,
          draggable: false,
          resizable: false,
          show: "fade",
          hide: "fade",
          closeOnEscape: false,
          open: function (event, ui) {
            $(".ui-dialog-titlebar-close", ui.dialog | ui).hide();
          },
        });

        var $recovery_pass_steps = $("#recovery_pass_steps").steps({
          headerTag: "h3",
          bodyTag: "section",
          transitionEffect: "none",
          autoFocus: true,
          enablePagination: false,
          onInit: function (event, current) {
            $(".actions > ul > li:first-child").attr("style", "display:none");
            $('#recovery_pass_steps ul[role="tablist"]').hide();
            $('#recovery_pass_steps h3[tabindex="-1"]').hide();
          },
        });

        $pass_reset_next_step.click(function () {
          showNextStep();
        });

        function showNextStep() {
          var currentStep = $recovery_pass_steps.steps("getCurrentIndex");

          if (currentStep == 0) {
            if ($("input[name=pass_reset_userName]").attr("data-validated") == 0) {
              validateResetUserName();
              return;
            }

            $pass_reset_back_step.show();
          } else if (currentStep == 1) {
            if ($("input[name=pass_reset_sms_code]").attr("data-validated") == 0) {
              validateSmsCode();
              return;
            }

            $pass_reset_back_step.show();
            $pass_reset_next_step.hide();
            $pass_reset_submit.show();
          } else if (currentStep == 2) {
            $pass_reset_back_step.hide();
            $pass_reset_submit.hide();
          }

          $recovery_pass_steps.steps("next");
        }

        $pass_reset_back_step.click(function () {
          var currentStep = $recovery_pass_steps.steps("getCurrentIndex");
          $("input[name=pass_reset_phoneNumber]").val("");
          $("input[name=pass_reset_userName]").val("");

          if (currentStep == 1) {
            var $smsCodeInput = $("input[name=pass_reset_sms_code]");
            $smsCodeInput.val("");
            $smsCodeInput.attr("data-validated", 0);

            $pass_reset_back_step.hide();
            $pass_reset_next_step.show();
          } else if (currentStep == 2) {
            $pass_reset_submit.hide();
            $pass_reset_next_step.show();
          }

          $recovery_pass_steps.steps("previous");
        });

        function passResetValiadationFunction(data, message, success) {
          if (!success) {
            $("[resetPasswordValidationContainer=" + data + "] .error2").text(message);

            if (data == "password") {
              $("[resetPasswordValidationContainer=passProgress] .progress-bar-danger").css("display", "block");
              $("[resetPasswordValidationContainer=passProgress] .progress-bar-warning").css("display", "none");
              $("[resetPasswordValidationContainer=passProgress] .progress-bar-success").css("display", "none");
            }
          } else if (success) {
            $("[resetPasswordValidationContainer=" + data + "] .error2").empty();
            if (data == "password") {
              $("[resetPasswordValidationContainer=passProgress] .progress-bar-danger").css("display", "none");
              $("[resetPasswordValidationContainer=passProgress] .progress-bar-warning").css("display", "block");
              $("[resetPasswordValidationContainer=passProgress] .progress-bar-success").css("display", "none");

              var length = $('input[name="pass_reset_new_password"]').val().length;

              if (length > 10) {
                $("[resetPasswordValidationContainer=passProgress] .progress-bar-danger").css("display", "none");
                $("[resetPasswordValidationContainer=passProgress] .progress-bar-warning").css("display", "none");
                $("[resetPasswordValidationContainer=passProgress] .progress-bar-success").css("display", "block");
              }
            }
          }
        }

        function validateResetUserName() {
          var $smsCodeInput = $("[name=pass_reset_sms_code]");
          $smsCodeInput.val("");
          $smsCodeInput.attr("data-validated", 0);

          var $this = $("input[name=pass_reset_userName]");
          var $thisphone = $("input[name=pass_reset_phoneNumber]");
          var $mobileNumber = $("input[name=pass_reset_mobile]");

          $.ajax({
            type: "POST",
            data: "userName=" + $this.val() + "&phoneNumber=" + "90" + $thisphone.val(),
            url: "/tr/Security/ValidateUserNameAndMobileForPasswordRecovery",
            success: function (data) {
              passResetValiadationFunction(data.data, data.message, data.success);
              $this.attr("data-validated", data.success ? 1 : 0);

              if (data.success) {
                $mobileNumber.val(data.message);
              } else {
                $mobileNumber.val("+ *** ** ******");
              }
            },
          });
        }

        function validateSmsCode() {
          var $this = $("input[name=pass_reset_sms_code]");

          $.ajax({
            type: "POST",
            data: "userName=" + $("input[name=pass_reset_userName]").val() + "&smsCode=" + $this.val(),
            url: "/tr/Security/ValidateSmsCodeByUsername",
            success: function (data) {
              passResetValiadationFunction(data.data, data.message, data.success);
              $this.attr("data-validated", data.success ? 1 : 0);
            },
          });
        }

        function validateResetPassword() {
          var $this = $("input[name=pass_reset_new_password]");
          var password = $this.val();

          if (password.length > 7) {
            $.ajax({
              type: "POST",
              data: "password=" + password,
              url: "/tr/Security/ValidatePassword",
              success: function (data) {
                passResetValiadationFunction(data.data, data.message, data.success);
                $this.attr("data-validated", data.success ? 1 : 0);
              },
            });
          } else {
            passResetValiadationFunction("password", "Şifre en az sekiz karakter olmalıdır.", false);
            $this.attr("data-validated", 0);
          }
        }

        function validateResetConfirmPassword() {
          var $this = $("input[name=pass_reset_confirm_new_password]");

          var confirmPassword = $this.val();
          var password = $sn_password_recovery_modal.find("input[name=pass_reset_new_password]").val();

          $.ajax({
            type: "POST",
            data: "password=" + password + "&passwordConfirm=" + confirmPassword,
            url: "/tr/Security/ValidatePasswordConfirm",
            success: function (data) {
              passResetValiadationFunction(data.data, data.message, data.success);
              $this.attr("data-validated", data.success ? 1 : 0);
            },
          });
        }

        $("input[name=pass_reset_userName]").focusout(function () {
          validateResetUserName();
        });

        $("input[name=pass_reset_sms_code]").focusout(function () {
          validateSmsCode();
        });

        $("input[name=pass_reset_new_password]").bind("keyup", function () {
          validateResetPassword();
        });

        $("input[name=pass_reset_confirm_new_password]").focusout(function () {
          validateResetConfirmPassword();
        });

        $pass_reset_submit.click(function () {
          loader.dialog("open");

          $.ajax({
            type: "POST",
            data:
              "userName=" +
              $("[name=pass_reset_userName]").val() +
              "&newPassword=" +
              $("[name=pass_reset_new_password]").val() +
              "&newPasswordConfirm=" +
              $("[name=pass_reset_confirm_new_password]").val() +
              "&smsCode=" +
              $("[name=pass_reset_sms_code]").val(),
            url: "/tr/Security/RecoveryPassword",
            success: function (data) {
              $(".loader").dialog("close");

              if (!data.success) {
                $.each(data.L, function (i, item) {
                  if (item.data == "smsCode") {
                    passResetValiadationFunction("confirmPassword", item.message, item.success);
                  } else {
                    passResetValiadationFunction(item.data, item.message, item.success);
                  }
                });
              } else {
                showNextStep();
              }
            },
          });
        });

        function onResetPassSendSms() {
          var validated = true;

          if ($("input[name=pass_reset_userName]").attr("data-validated") == 0) {
            validateResetUserName();
            validated = false;
          }

          return validated;
        }

        $("#pass_reset_send_code").on("click", function () {
          if (!onResetPassSendSms()) {
            return false;
          }

          SendSmsVerificationCodeByUserName();
        });

        function SendSmsVerificationCodeByUserName() {
          var $pass_reset_send_code = $("#pass_reset_send_code");

          $.ajax({
            type: "POST",
            data: "userName=" + $("[name=pass_reset_userName]").val(),
            url: "/tr/Security/SendSmsVerificationCodeByUserName",
            success: function (data) {
              passResetValiadationFunction("smsCode", data.message, data.success);

              if (data.success) {
                $pass_reset_send_code.attr("disabled", true);
                startResetPassTimer();
                $("#sms_code_delivery_message").text("SMS Kodu yukarıdaki numaraya gönderildi.");
              } else {
                $("#sms_code_delivery_message").empty();
                $pass_reset_send_code.attr("disabled", false);
              }
            },
          });
        }

        function startResetPassTimer() {
          var $pass_reset_send_code = $("#pass_reset_send_code");
          var $timer = $("#reset_pass_sms_timer");
          var duration = 30;

          function updateTimer() {
            if (duration >= 0) {
              if (duration < 10) {
                $timer.text("00:0" + duration);
              } else {
                $timer.text("00:" + duration);
              }
            } else {
              clearInterval(timeinterval);
              $pass_reset_send_code.attr("disabled", false);
              $pass_reset_send_code.text("Tekrar Gönder");
            }

            duration--;
          }

          var timeinterval = setInterval(updateTimer, 1000);
        }
      })();
    </script>