如果未选择Meteor用户帐户,请记住我,然后在浏览器关闭时注销?

时间:2022-06-04 19:41:46

I am using meteor user accounts for login . Now I have customized login forms and used their methods to login. Now i want to add remember me check box. If its not selected user should be logged out. Otherwise he can resume his session unless he manually log out. Any idea or concept what ever you can provide would be appreciated.

我正在使用meteor用户帐户登录。现在我已经定制了登录表单并使用他们的方法登录。现在我想添加记住我复选框。如果未选择的用户应该注销。否则他可以恢复他的会话,除非他手动注销。任何想法或概念,你能提供什么,将不胜感激。

1 个解决方案

#1


Can not test this at the moment, but you could use onbeforeunload or onunload events, and process the logout in that step

目前无法对此进行测试,但您可以使用onbeforeunload或onunload事件,并在该步骤中处理注销

window.onbeforeunload = function () {
    Meteor.logout();
};

#1


Can not test this at the moment, but you could use onbeforeunload or onunload events, and process the logout in that step

目前无法对此进行测试,但您可以使用onbeforeunload或onunload事件,并在该步骤中处理注销

window.onbeforeunload = function () {
    Meteor.logout();
};