Accounts.createUser dont insert to mongodb

I have this code create.js:

Template.register.events({
  'submit form': function(event) {
        event.preventDefault();
        var emailVar = event.target.registerEmail.value;
        var passwordVar = event.target.registerPassword.value;

        Accounts.createUser({
            email: emailVar,
            password: passwordVar
        });

     
    }
});

This create.html


<template name="register">
<form>
		<div class="mdl-card mdl-shadow--6dp" style="opacity: 0.9; filter: alpha(opacity=90); /* For IE8 and earlier */" >
			<div class="mdl-card__title mdl-color--third mdl-color-text--black" style="align-items: center;
  justify-content: center; ">
				logo
			</div>
	  	<div class="mdl-card__supporting-text">
				
					<div class="mdl-textfield mdl-js-textfield">
						<input class="mdl-textfield__input" type="email" id="registerEmail" name="registerEmail" />
						<label class="mdl-textfield__label" for="registerEmail">Email</label>
					</div>
					<div class="mdl-textfield mdl-js-textfield">
						<input class="mdl-textfield__input" type="password" id="registerPassword" name="registerPassword" />
						<label class="mdl-textfield__label" for="registerPassword">Password</label>
					</div>
			
			


			</div>
		

			<div class="mdl-card__actions mdl-card--border" style="text-align: center;">
			
				<button style="margin-left:115px;" type='submit' value="Register" class="mdl-button mdl-button--raised ">Register</button>
			</div>
			
		</div>

			</form>

</template>

And all these packages:


meteor-base@1.0.4             # Packages every Meteor app needs to have
mobile-experience@1.0.4       # Packages for a great mobile UX
mongo@1.1.14                   # The database Meteor supports right now
blaze-html-templates@1.0.4    # Compile .html files into Meteor Blaze views
reactive-var@1.0.11            # Reactive variable for tracker
jquery@1.11.10                  # Helpful client-side library
tracker@1.1.1                 # Meteor's client-side reactive programming library

standard-minifier-css@1.3.2   # CSS minifier run for production mode
standard-minifier-js@1.2.1    # JS minifier run for production mode
es5-shim@4.6.15                # ECMAScript 5 compatibility for older browsers.
ecmascript@0.6.1              # Enable ECMAScript2015+ syntax in app code

# kadira:flow-router      # routs for pages
# kadira:blaze-layout     # blaze layout templates with flowrouter


autopublish@1.0.7             # Publish all data to the clients (for prototyping)
insecure@1.0.7                # Allow all DB writes from clients (for prototyping)
accounts-ui@1.1.9
accounts-password@1.3.3
msavin:mongol
accounts-google@1.0.11
accounts-twitter@1.1.12
accounts-ui-unstyled@1.1.13
zodiase:mdl
rajasegar:multilevelmenu

reactive-dict@1.1.8
gwendall:body-events
# thesabbir:jquery-nestable    show sidenav with nested childs
# utilities:menu   show sidenav with nested childs

http@1.2.10
# useraccounts:mdl # er fjernet pga den gjorde man ikke kune oprette en bruger 
meteortoys:allthings
ryanswapp:datetime-picker
momentjs:moment
brentjanderson:buzz
iron:router
npm-bcrypt@0.9.2
daishi:blaze-showhide
useraccounts:iron-routing

when i submit the form nothing are insertet to the mongodb, is it a package problem?

Do a console.log (“INSERTING TEST”); and see where your code is breaking. Could be as simple as your event not running.

I have made a console.log it worked fine

Now, You can make sure at meteor shell

Meteor.users.find().fetch()

Took a peek at my code which is working super well. I have a return error function, you should really add it to find out more.

Accounts.createUser({

}, function(error){
alert(error)
});

I get the error message: Signups forbidden [403]

Nothing in the DB: I use: Robomongo 0.9.0 for Windows

This thread may be of use: [SOLVED] SignUps Forbidden on Accounts.createUser

aha! So you know your code is working, you have some sort of permission error. Looks like there’s some config to do with your packages. It’s been a straight up year since I was in your shoes. Keep digging. Meteor is worth it. Wish I had these forums when I started…

I got it to work with this solution: [SOLVED ]Can't create new users: Accounts.createUser() --> undefined