如果用户点击页面上的任何链接,我会检查用户是否在控制器方法中登录。如果他没有登录,那么我会在屏幕上显示登录屏幕模式。
到目前为止一切正常。
如果用户输入错误的用户名密码。下一页显示为没有任何 CSS 的新页面。
我如何将结果返回到模式登录屏幕?
查看/index.php
$('.index-product img').click(function() {
var product = $('<div id="modal-productDetail" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"></div>');
$.ajax({
url: "<?php echo site_url('gallery/openProductDetail');?>",
type: 'POST',
success: function(msg) {
product.html(msg);
product.modal('show');
}
});
});
控制器
function openProductDetail()
{
if (!$this->ion_auth->logged_in())
{
redirect('auth/login');
} else {
$this->load->view('modal/productdetail');
}
}
查看/login.php
<div class="modal-header">
<h4 id="myModalLabel">Login To Your Account</h4>
</div>
<div id="loginModal" class="modal-body">
<div class="row">
<?php echo form_open("auth/login");?>
<div class="span3">
<ul class="unstyled" id="emailLogin">
<li><small class="muted">Login with your email</small></li>
<?php echo form_open("auth/login");?>
<li>
<input name="identity" value="" id="identity" type="text" placeholder="Email Address"/>
<span class="help-block" id="emailError" style="display:none;"></span>
</li>
<li>
<input name="password" value="" id="password" type="password" placeholder="Password"/>
<span class="help-block" id="passwordError" style="display:none;"></span>
</li>
<li>
<input style="display:none;" name="remember" value="1" id="remember" type="checkbox">
</li>
<li>
<a class="text-info" id="accountProblem" href="auth/forgot_password">Account problem?</a>
<input class="loginButton" type="submit" name="submit" value="Login">
<?php echo form_close();?>
</li>
<li>
<div id="infoMessage"><?php echo $message;?></div>
</li>
</ul>
</div>
</div>
</div>