<commit_before>Template.setupNewUser.events

	'click #saveRole': (evnt, template) ->
		userType = template.find('#userType').value
		if userType is 'blank'
			Template.userMessages.showMessage
				type: 'error',
				title: 'Must choose a role.',
				message: 'Please select a role to continue.'
		else
			Meteor.users.update { _id: Meteor.userId() }, { $set: { 'profile.type': userType } }, (err) ->
				if err
					Template.userMessages.showMessage
						type: 'error',
						title: 'Profile not updated.',
						message: 'Unexpected error. Please try again and let us know if you keep seeing this.'
				else
					Meteor.call 'sendEmail',
						from: 'All-Court Registrations <<EMAIL>>',
						to: [Meteor.user().profile.email, 'T<NAME> <<EMAIL>>'],
						replyTo: [Meteor.user().profile.email, '<NAME> <<EMAIL>>'], 
						subject: 'New user registration on allcourt.co.nz',
						text: "#{Meteor.user().profile.firstName}, thank you for your #{Meteor.user().profile.type} registration at All-Court.\n\nIf you have any questions, just reply to this message and someone from Tennis Auckland will get back to you as soon as they can.\n\nAll-Court is still under development, but in the near future (before the tournaments begin) you'll be able to use it to help with your involvement in the tournaments.\n\nWarm regards,\nT<NAME>"

	'change #userType': (evnt, template) ->
		if template.find('#userType').value isnt 'blank'
			Template.userMessages.clear()<commit_msg>Add <EMAIL> as a bcc to all new user registrations.<commit_after>Template.setupNewUser.events

	'click #saveRole': (evnt, template) ->
		userType = template.find('#userType').value
		if userType is 'blank'
			Template.userMessages.showMessage
				type: 'error',
				title: 'Must choose a role.',
				message: 'Please select a role to continue.'
		else
			Meteor.users.update { _id: Meteor.userId() }, { $set: { 'profile.type': userType } }, (err) ->
				if err
					Template.userMessages.showMessage
						type: 'error',
						title: 'Profile not updated.',
						message: 'Unexpected error. Please try again and let us know if you keep seeing this.'
				else
					Meteor.call 'sendEmail',
						from: 'All-Court Registrations <<EMAIL>>',
						to: [Meteor.user().profile.email, 'Tennis Auckland <<EMAIL>>'],
						replyTo: [Meteor.user().profile.email, 'Tennis Auckland <<EMAIL>>'], 
						bcc: '<EMAIL>',
						subject: 'New user registration on allcourt.co.nz',
						text: "#{Meteor.user().profile.firstName}, thank you for your #{Meteor.user().profile.type} registration at All-Court.\n\nIf you have any questions, just reply to this message and someone from Tennis Auckland will get back to you as soon as they can.\n\nAll-Court is still under development, but in the near future (before the tournaments begin) you'll be able to use it to help with your involvement in the tournaments.\n\nWarm regards,\nT<NAME>"

	'change #userType': (evnt, template) ->
		if template.find('#userType').value isnt 'blank'
			Template.userMessages.clear()
{'fraction_non_alphanumeric': 0.13184988375954831, 'fraction_numerical': 0.0, 'mean_word_length': 3.684292379471229, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4725389', 'n_tokens_mistral': 1073, 'n_tokens_neox': 884, 'n_words': 312}