Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ember.js/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ember.js 灰烬简单身份验证还原后缺少道具_Ember.js_Ember Simple Auth_Ember Addon - Fatal编程技术网

Ember.js 灰烬简单身份验证还原后缺少道具

Ember.js 灰烬简单身份验证还原后缺少道具,ember.js,ember-simple-auth,ember-addon,Ember.js,Ember Simple Auth,Ember Addon,当我第一次登录时,将一些道具设置为this.get('session'),一切正常。代码如下: actions: { // display an error when authentication fails authenticate: function() { var _this = this; var credentials = this.getProperties('identification', 'password'); this.get('session').auth

当我第一次登录时,将一些道具设置为this.get('session'),一切正常。代码如下:

  actions: {
// display an error when authentication fails
authenticate: function() {
  var _this = this;
  var credentials = this.getProperties('identification', 'password');
  this.get('session').authenticate('authenticator:custom', credentials).then(
  function() {
    var username = _this.get('session.secure.data.name');
    //look here, I set a username props to session object
    _this.get('session').set('username', username);
    //debugger;
  }, function(message) {
    // but the reject callback works fine, the message is the right one
    _this.set('errorMessage', message.msg);
    _this.set('identification', '');
    _this.set('password', '');
  });
 }
}
下面是哈佛商学院

{{#if session.isAuthenticated}}
  Hi,{{session.username}}
{{else}}
{{#link-to 'login'}} Login {{/link-to}}
  or
{{#link-to 'signup'}} Signup {{/link-to}}
{{/if}}
现在一切正常,但在我刷新页面之后

{{session.username}
未定义

我怎样才能解决这个问题


Thx

请提供验证器的来源。@Marcow这是验证器的来源:
还原
方法仅在存在
data.data.name
时才解析-是否正确?看起来很奇怪…