Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Template.signUp.onRendered(function(){
- // Validation
- var validator=$('form#formSignUp').validate({
- rules:{
- password_confirm:{
- required:true,
- equalTo:'[name=password]'
- },
- min_age:{
- required:true
- }
- },
- messages:{
- password_confirm:{
- equalTo:'The passwords do not match'
- },
- min_age:{
- required:'You have to confirm your age'
- }
- },
- submitHandler:function(e){
- var username=$('[name=username]').val(),
- email=$('[name=email]').val(),
- password=$('[name=password]').val();
- Accounts.createUser({
- username:username,
- email:email,
- password:password
- },function(error){
- if(error){
- if(error.reason=='Incorrect password'){
- validator.showErrors({
- password:error.reason
- });
- }
- }else{
- FlowRouter.go('home');
- }
- });
- }
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement