mmrj9
July 4, 2016, 1:36pm
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;
});
Well first of all you shoudlnât validate the password on the client.
Do you have an Accounts.validateNewUser maybe?
mmrj9
July 4, 2016, 2:11pm
3
thatâs used to validate the user fields and the passwordAgain is not a user field
reoh
July 4, 2016, 6:30pm
4
That is the error you get if the following was called in your app:
Accounts.config({
forbidClientAccountCreation: true
});
mmrj9
July 4, 2016, 8:24pm
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
});
reoh
July 4, 2016, 10:43pm
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
});
mmrj9
July 4, 2016, 11:22pm
7
I tried that but on \lib. But still getting the same error
mmrj9
July 4, 2016, 11:37pm
8
Here is a link to the repo
mmrj9
July 5, 2016, 11:01am
9
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