admin管理员组文章数量:1435859
I have a custom log in form for users of my website where they can log in then view some information that related to them.
The problem is sometimes this form will loop. I will get the message "login sucessfull" but rather than redirecting to the page where it should go, it seems to refresh the login form and users have to enter their details again.
If the user attempts to log in a couple of times it will then allow them in. After this point they can log out/in without issue (for a short period).
I have tried clearing cookies and cache after a sucessfull login to replicate or narrow down the issue. But in this case the login is sucessfull again.
Would anyone have some advice how I could troubleshoot this?
<?php
/*
* Template Name: Login Form
*/
get_header() ?>
<div class="loading">
<div class="loading-icon">
<svg version="1.1" id="loader-1" xmlns="" xmlns:xlink="" x="0px" y="0px"
width="40px" height="40px" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve">
<path fill="#002e5b" d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z">
<animateTransform attributeType="xml"
attributeName="transform"
type="rotate"
from="0 25 25"
to="360 25 25"
dur="0.6s"
repeatCount="indefinite"/>
</path>
</svg>
</div>
</div>
<?php if(!is_user_logged_in()) { ?>
<div class="login_form container">
<div class="row">
<div class="col-12">
<form action="login_form">
<ul class="row login">
<li class="col-lg-4 offset-lg-4">
<h2><?php _e('Sign In') ?></h2>
</li>
<li class="col-lg-4 offset-lg-4">
<input placeholder="Enter your email address" type="email" name="email_address">
</li>
<li class="col-lg-4 offset-lg-4">
<input placeholder="Enter your password" type="password" name="password">
</li>
<li class="col-lg-4 offset-lg-4">
<p class="status"> </p>
</li>
<li class="col-lg-4 offset-lg-4">
<?php wp_nonce_field('ajax-login-nonce', 'security') ?>
<a class="button secondary thick submit" href="#" id="login-button"><?php _e('Sign in >') ?></a>
</li>
</ul>
</form>
</div>
</div>
</div>
<script>
jQuery(window).load(function() {
login();
});
</script>
<?php } else { ?>
<script>
$(document).ready(function() {
var location = "<?php echo home_url() ?>";
window.location.href = location;
});
</script>
<?php } ?>
<?php get_footer() ?>
本文标签: phpHow to debug my custom login form looping intermittently
版权声明:本文标题:php - How to debug my custom login form looping intermittently 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745615252a2666360.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论