Skip to content

Commit

Permalink
fix: 登陆模板
Browse files Browse the repository at this point in the history
  • Loading branch information
KotoriK committed Jan 19, 2022
1 parent 80d9970 commit 3f5e43e
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions user/page-login.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,24 @@
</div>
<?php if (iro_opt('captcha_select') === 'iro_captcha') {?>
<script>
const get_captcha = ele=>fetch("<?php echo rest_url('sakura/v1/captcha/create')?>")
if(!'get_captcha' in window){
var get_captcha = ele=>fetch("<?php echo rest_url('sakura/v1/captcha/create')?>")
.then(async res=>{
const data = res.json();
if (res.ok){
const json = await res.json();
ele.src = json['data'];
document.querySelector("input[name='timestamp']").value = json["time"];
document.querySelector("input[name='id']").value = json["id"];
}else{
//TODO: 错误处理
}
});
});
const captcha = document.getElementById("captchaimg");
captcha && captcha.addEventListener("click",e=>get_captcha(e.target));
captcha && get_captcha(captcha);
if(captcha){
captcha.addEventListener("click",e=>get_captcha(e.target));
get_captcha(captcha);
}
}
</script>
<?php } ?>
<?php }else{ echo Exuser_center(); } ?>
Expand Down

0 comments on commit 3f5e43e

Please sign in to comment.