{"id":722,"date":"2025-09-28T08:27:38","date_gmt":"2025-09-28T08:27:38","guid":{"rendered":"https:\/\/7d-shop.com\/?page_id=722"},"modified":"2025-11-02T12:26:27","modified_gmt":"2025-11-02T12:26:27","slug":"last-loginn","status":"publish","type":"page","link":"https:\/\/7d-shop.com\/en\/last-loginn\/","title":{"rendered":"last login"},"content":{"rendered":"<div class=\"sa-card\">\n  <h3>\u062a\u0633\u062c\u064a\u0644 \u0627\u0644\u062f\u062e\u0648\u0644<\/h3>\n  <label>\u0631\u0642\u0645 \u0627\u0644\u062c\u0648\u0627\u0644 (\u0627\u0644\u0633\u0639\u0648\u062f\u064a\u0629)<\/label>\n  <div class=\"sa-phone-grid\">\n    <div class=\"sa-prefix\">\ud83c\uddf8\ud83c\udde6 +966<\/div>\n    <div class=\"sa-box\">\n      <input id=\"sal_phone_local\" class=\"sa-input\" inputmode=\"numeric\"\n             pattern=\"[0-9\u0660-\u0669\u06f0-\u06f9]*\" placeholder=\"5XXXXXXXXX\">\n    <\/div>\n  <\/div>\n  <input type=\"hidden\" name=\"nonce\" value=\"5d098d001b\">  <button id=\"sal_send\" class=\"sa-btn\">\u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0643\u0648\u062f<\/button>\n  <p id=\"sal_msg\" class=\"sa-msg\"><\/p>\n\n  <div id=\"sal_otp_wrap\" class=\"sa-hidden\">\n    <label>\u0623\u062f\u062e\u0644 \u0627\u0644\u0643\u0648\u062f<\/label>\n    <div class=\"sa-otp-box\">\n              <input type=\"text\" maxlength=\"1\" class=\"sa-otp-digit sal_otp_digit\">\n              <input type=\"text\" maxlength=\"1\" class=\"sa-otp-digit sal_otp_digit\">\n              <input type=\"text\" maxlength=\"1\" class=\"sa-otp-digit sal_otp_digit\">\n              <input type=\"text\" maxlength=\"1\" class=\"sa-otp-digit sal_otp_digit\">\n              <input type=\"text\" maxlength=\"1\" class=\"sa-otp-digit sal_otp_digit\">\n              <input type=\"text\" maxlength=\"1\" class=\"sa-otp-digit sal_otp_digit\">\n          <\/div>\n    <button id=\"sal_verify\" class=\"sa-btn\">\u062a\u0623\u0643\u064a\u062f<\/button>\n    <p id=\"sal_msg2\" class=\"sa-msg\"><\/p>\n  <\/div>\n<\/div>\n\n<script>\njQuery(function($){\n  function normalizeDigits(s){\n    const ar={'\u0660':'0','\u0661':'1','\u0662':'2','\u0663':'3','\u0664':'4','\u0665':'5','\u0666':'6','\u0667':'7','\u0668':'8','\u0669':'9'};\n    const fa={'\u06f0':'0','\u06f1':'1','\u06f2':'2','\u06f3':'3','\u06f4':'4','\u06f5':'5','\u06f6':'6','\u06f7':'7','\u06f8':'8','\u06f9':'9'};\n    return (s||'')\n      .replace(\/[^\\d\u0660-\u0669\u06f0-\u06f9]\/g,'')\n      .replace(\/[\u0660-\u0669]\/g,c=>ar[c])\n      .replace(\/[\u06f0-\u06f9]\/g,c=>fa[c]);\n  }\n  function toE164KSA(raw){\n    let d=normalizeDigits(raw);\n    d=d.replace(\/^(00966|966|00)\/,'');\n    d=d.replace(\/^0+\/,'');\n    const m=d.match(\/5\\d{8}\/);\n    return m?'+966'+m[0]:null;\n  }\n  const OTP_LEN = 6;\n  const otpVal = cls => {\n    let v=\"\";\n    $(\".\"+cls).each(function(){\n      v += normalizeDigits($(this).val()).slice(0,1);\n    });\n    return v;\n  };\n\n  $(document).on(\"input\",\".sal_otp_digit\",function(){\n    this.value = normalizeDigits(this.value).slice(0,1);\n    if(this.value && this.nextElementSibling) this.nextElementSibling.focus();\n  });\n  $(document).on(\"keydown\",\".sal_otp_digit\",function(e){\n    if(e.key===\"Backspace\" && !this.value && this.previousElementSibling)\n      this.previousElementSibling.focus();\n  });\n  $(document).on(\"paste\",\".sa-otp-digit\",function(e){\n    e.preventDefault();\n    const ev = e.originalEvent || e;\n    let text = (ev.clipboardData || window.clipboardData).getData(\"text\") || \"\";\n    text = normalizeDigits(text).slice(0, OTP_LEN);\n    const $in = $(this).closest(\".sa-otp-box\").find(\"input.sa-otp-digit\");\n    for(let i=0;i<$in.length;i++) $in.eq(i).val(text[i]||\"\");\n    ($in[text.length] || $in[$in.length-1]).focus();\n  });\n  $(document).on(\"focus\",\".sa-otp-digit\",function(){ this.select(); });\n\n  let phone=\"\";\n  $(\"#sal_send\").on(\"click\",function(e){\n    e.preventDefault();\n    phone=toE164KSA($(\"#sal_phone_local\").val());\n    if(!phone){\n      $(\"#sal_msg\").css(\"color\",\"#b00020\").text(\"\u0623\u062f\u062e\u0644\u064a \u0631\u0642\u0645 \u0633\u0639\u0648\u062f\u064a \u0635\u062d\u064a\u062d\");\n      return;\n    }\n    $(\"#sal_msg\").css(\"color\",\"#555\").text(\"\u062c\u0627\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644...\");\n    $.post(\"https:\/\/7d-shop.com\/wp-admin\/admin-ajax.php\",{\n      action:\"sa_login_req_otp\",\n      phone:phone,\n      nonce:$(\"input[name=nonce]\").val()\n    },function(res){\n      if(res.success){\n        $(\"#sal_msg\").css(\"color\",\"#0a7a2f\").text(res.data.msg||\"\u062a\u0645 \u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0643\u0648\u062f\");\n        $(\"#sal_otp_wrap\").removeClass(\"sa-hidden\");\n        $(\".sal_otp_digit\").first().focus();\n      }else{\n        $(\"#sal_msg\").css(\"color\",\"#b00020\")\n          .text(res.data && res.data.msg ? res.data.msg : \"\u062a\u0639\u0630\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644\");\n      }\n    });\n  });\n\n  $(\"#sal_verify\").on(\"click\",function(e){\n    e.preventDefault();\n    $(\"#sal_msg2\").css(\"color\",\"#555\").text(\"\u062c\u0627\u0631 \u0627\u0644\u062a\u062d\u0642\u0642...\");\n    $.post(\"https:\/\/7d-shop.com\/wp-admin\/admin-ajax.php\",{\n      action:\"sa_login_verify\",\n      phone:phone,\n      otp:otpVal(\"sal_otp_digit\"),\n      nonce:$(\"input[name=nonce]\").val()\n    },function(res){\n      if(res.success && res.data && res.data.redirect){\n        window.location = res.data.redirect;\n      }else if(!res.success && res.data && res.data.redirect){\n        \/\/ \u0631\u0642\u0645 \u063a\u064a\u0631 \u0645\u0633\u062c\u0651\u0644 \u2192 \u062a\u062d\u0648\u064a\u0644 \u062a\u0644\u0642\u0627\u0626\u064a \u0644\u0635\u0641\u062d\u0629 \u0627\u0644\u062a\u0633\u062c\u064a\u0644\n        window.location = res.data.redirect;\n      }else if(res.success){\n        window.location = \"\/my-account\/\";\n      }else{\n        $(\"#sal_msg2\").css(\"color\",\"#b00020\")\n          .text(res.data && res.data.msg ? res.data.msg : \"\u062a\u0639\u0630\u0651\u0631 \u0627\u0644\u062a\u062d\u0642\u0642\");\n      }\n    });\n  });\n});\n<\/script>\n\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-722","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/7d-shop.com\/en\/wp-json\/wp\/v2\/pages\/722","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/7d-shop.com\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/7d-shop.com\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/7d-shop.com\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/7d-shop.com\/en\/wp-json\/wp\/v2\/comments?post=722"}],"version-history":[{"count":3,"href":"https:\/\/7d-shop.com\/en\/wp-json\/wp\/v2\/pages\/722\/revisions"}],"predecessor-version":[{"id":736,"href":"https:\/\/7d-shop.com\/en\/wp-json\/wp\/v2\/pages\/722\/revisions\/736"}],"wp:attachment":[{"href":"https:\/\/7d-shop.com\/en\/wp-json\/wp\/v2\/media?parent=722"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}