0

我正在使用 ember-cli-simple-auth 和 cookie-store 附加组件,我已经设置了我的应用程序和登录路由以及经过身份验证的路由,几乎所有这些都在工作,但是如果我重新加载页面,或者如果 livereload 为我做这件事,我会被踢回登录页面,必须输入凭据,然后再回到我所在的页面。鉴于文档所说的,我认为这不应该发生:

Ember Simple Auth 保持会话状态,因此它在页面重新加载后仍然存在。

https://github.com/simplabs/ember-simple-auth

我应该寻找什么来解决这个问题?

编辑:添加身份验证后设置的 cookie

cookie 名称:ember_simple_auth:session

%7B%22authenticator%22%3A%22authenticator%3Acustom%22%2C%22auth_token%22%3A%226hxR0eEL0EbHjPpfWFmdiWfKqHXLfXdYqG9wdZKgnlh3BacNvd41OHl6aOLFAv5C%22%2C%22account_id%22%3A%22A461225%22%2C%22full_name%22%3A%22Jess%20Hines %22%7D

编辑 这个问题是相似的,所以看起来我真正需要的是帮助编写restore()函数。

4

1 回答 1

0

@marcoow 在此 github 问题上提供的示例。

这是我的恢复功能:

restore: function(data) {
  return new Ember.RSVP.Promise(function(resolve, reject) {
    if (!Ember.isEmpty(data)) {
      resolve(data);
    } else {
      reject();
    }
  });
}
于 2014-10-31T12:29:35.453 回答