[SOLVED] SignUps Forbidden on Accounts.createUser

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;
});

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

Do you have an Accounts.validateNewUser maybe?

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

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

Accounts.config({
  forbidClientAccountCreation: true
});

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
});

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
});

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

Here is a link to the repo

i had to remove the useraccounts:materialize package

3 Likes

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

Same here, except had to remove useraccounts:bootstrap