【问题标题】:Meteor+React Username deleted after logout注销后删除 Meteor+React 用户名
【发布时间】:2015-10-30 01:23:03
【问题描述】:

我正在尝试使用 React 和 accounts-base、accounts-password 包实现自定义登录。

注册

handleRegistrationSubmit(event){
        event.preventDefault();
        var email = React.findDOMNode(this.refs.emailInputReg).value.trim();
        var password = React.findDOMNode(this.refs.passwordInputReg).value.trim();
        Accounts.createUser({
            email: email,
            password: password
        })
    },

登录

 handleLoginSubmit(event){
        event.preventDefault();
        var email = React.findDOMNode(this.refs.emailInputLogin).value.trim();
        var password = React.findDOMNode(this.refs.passwordInputLogin).value.trim();
        Meteor.loginWithPassword(email, password, function(err){
            if (err){
                console.log(err)
            }
        });
    },

退出

handleLogout(event){
        event.preventDefault();
        Meteor.logout(function(err){
            if(err){
                console.log(err)
            }
        });
    },

注册运行良好,创建并登录了一个新用户。 如果我去控制台输入

Meteor.users.find().fetch()

它返回刚刚使用 _id 和电子邮件字段创建的用户。

当我注销时,电子邮件字段消失,用户只有 _id 字段。

如果我尝试登录它会说

User not found [403]

我不明白为什么只删除了电子邮件字段,但用户对象仍然存在。注册和注销中均未显示错误。 我不知道为什么会这样。

感谢您的帮助

【问题讨论】:

    标签: mongodb meteor meteor-accounts meteor-react


    【解决方案1】:

    好的..解决了。似乎如果在注销后电子邮件格式错误,它就会被删除。我不知道为什么,但是如果我尝试使用“test@test.com”它可以工作,但是使用“test”会创建用户并且在注销后删除电子邮件字段

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-02-24
      • 2012-09-28
      • 1970-01-01
      • 2015-01-14
      • 1970-01-01
      • 1970-01-01
      • 2013-05-02
      相关资源
      最近更新 更多