Skip to content

E、记住我

wangjie edited this page Dec 25, 2019 · 1 revision

记住我相关配置属性:

#jsets-shiro配置
jsets:
  shiro:
    #记住我有效期(单位为毫秒),不配置默认7天(604800000毫秒)
    rememberme-max-age: 604800000 
    #记住我 cookie加密秘钥(长度需要为8的倍数),不配置默认使用一组乱序数字
    rememberme-secret-key: 123456789abcdefh 

页面:

<form class="login-form" action="${ctx}/login" method="post">
    <div class="form-item">
        用户名:<input type="text" name="username" />
    </div>
    <div class="form-item">
        密码:<input type="password" name="password" />
    </div>
    <div class="form-item">
        验证码:<input type="text" name="jcaptcha" />
        <img alt="点击切换" src="${ctx}/jcaptcha.jpg"           
        onclick="this.src='${ctx}/jcaptcha.jpg?d='+new Date()" />
    </div>
    <div class="form-item">
        记住我:<input name="rememberMe" type="checkbox" />
    </div>
    <div class="form-item">
        <button type="submit">登录</button>
    </div>
</form>
<!-- 认证信息 -->
<font color="red">${Request["shiro_auth_message"]!}</font>

选中"记住我"复选框, 关闭浏览器,下次系统将会自动登陆。

记住我效果

Clone this wiki locally