简体   繁体   中英

Exception in delivering result of invoking 'createUser'

So i'm having trouble invoking the standard Meteor Accounts.createUser function. I'm trying to implement an accounts system using the meteor accounts-base and accounts-password packages. The project is on Meteor 1.3 with React.

When i invoke Accounts.createUser(userObject), i get "Exception in delivering result of invoking 'createUser'" with some cryptic mess behind it.

My code:

onSignUp(e) {
e.preventDefault();

let email = $(e.target).find("[name=email]").val(),
    password = $(e.target).find("[name=password]").val(),
    confirmPassword = $(e.target).find("[name=confirmPassword]").val();

if (password == confirmPassword) {
  Accounts.createUser({
    mail: email,
    password: password
  }, function(error){
    if (error) {
      Bert.alert( err.reason, 'danger', 'growl-top-right' );
    } else {
      Bert.alert( "Welcome!", 'success', 'growl-top-right');
      console.log(userObject);

      FlowRouter.go('/');
    }
  });

This is currently in my client folder but i tried moving the createAccount call to a server side method but it gives me the same error.

I tried running Meteor in debug mode but i'm having trouble understanding what's happening. From what i could understand while logging in there was either no result or the log in could not be validated.

Any help is much appreciated.

Replace

Accounts.createUser({
    mail: email,
    password: password
  }

with

Accounts.createUser({
        email: email,      //email
        password: password,
        profile :'default-group',
      }

Also, shift the account creation code to server side.

Refer : Meteor Docs

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM