[SOLVED] SignUps Forbidden on Accounts.createUser

#1

I’m getting the error “SignUps Forbidden” when i try to create a user account. Any ideas why?

My packages:

useraccounts:materialize
materialize:materialize
accounts-password
accounts-facebook
service-configuration
accounts-google
accounts-twitter
kadira:blaze-layout
msavin:mongol
kadira:flow-router
kevohagan:sweetalert

Client code:

if (isValidPassword(password, passwordAgain)) { 
    Accounts.createUser({
        email: email,
        firstName: firstName,
        lastName: lastName,
        password: password
    }, function(error) {
        if (error) {
            return swal({
            title: error.reason,
            text: "Please try again",
            showConfirmButton: true,
            type: "error"
        });
        } else {
            FlowRouter.go('/');
        }
    });
}

Server code:

 Accounts.onCreateUser(function(options, user) {
    user.profile = options.profile || {};

    user.profile.firstName = options.firstName;
    user.profile.lastName = options.lastName;

    user.profile.organization = ["Org"];
    user.roles = ["User"];

    return user;
});
#2

Well first of all you shoudln’t validate the password on the client.

Do you have an Accounts.validateNewUser maybe?

#3

that’s used to validate the user fields and the passwordAgain is not a user field

#4

That is the error you get if the following was called in your app:

Accounts.config({
  forbidClientAccountCreation: true
});
#5

it’s on the …\server\packages\useraccounts_core.js, every time i run the app the value returns to true

// Client side account creation is disabled by default:
// the methos ATCreateUserServer is used instead!
// to actually disable client side account creation use:
//
// AccountsTemplates.config({
// forbidClientAccountCreation: true
// });

Accounts.config({
forbidClientAccountCreation: true
});

#6

You can overwrite it in your client code because your code will run after the package did:

Accounts.config({
  // enable client user creation
  forbidClientAccountCreation: false
});
#7

I tried that but on \lib. But still getting the same error :confused:

Accounts.createUser dont insert to mongodb
#8

Here is a link to the repo

#9

i had to remove the useraccounts:materialize package

3 Likes
#10

Thanks man. Run into the same problem and this was the solution

#11

Same here, except had to remove useraccounts:bootstrap