def register_developer():
	return redirect(url_for('.index'))
	if g.user:
		flash(u'Вы уже зарегистрированы', 'warning')
		return redirect(url_for('.index'))
	
	form = forms.DeveloperRegisterForm(request.form)
	if request.method == 'POST' and form.validate():
		users.add_user(
			email=form.email.data,
			password_hash=generate_password_hash(form.password.data),
			first_name=form.first_name.data,
			last_name=form.last_name.data,
			organization=form.organization.data,
			phone=form.phone.data,
			messenger_type=form.messenger_type.data,
			messenger_uid=form.messenger_uid.data)
		user = users.get_user_by_email(form.email.data, full=True)
		if user:
			users.confirm_user(user.id)
			mmail.lists_add_user(user)
			users.add_user_role(user.id, roles.DEVELOPER)
			user.roles.append(roles.DEVELOPER)
			invites.register_invite(form.invite.data)
			session['user_id'] = user.id
			flash(u'Вы успешно зарегистрированы', 'success')
			return redirect(url_for('cabinet.index'))
		flash(u'Произошла ошибка при регистрации. Обратитесь к администрации.', 'error')
		
	return render_template('site/register-developer.html', form=form)
def register_customer():
	return redirect(url_for('.index'))
	if g.user:
		flash(u'Вы уже зарегистрированы', 'warning')
		return redirect(url_for('.index'))
	
	ref = session.get('ref', '')
	key = app.config.get('REFERRAL_CRYPT_KEY', 'qwertyui12345678')
	
	try:
		id, _salt = aes_base16_decrypt(key, ref).split('$')
		referrer = users.get_user_by_id(int(id))
		if not referrer or not referrer.is_customer():
			raise ValueError()
	except:
		form = None
	else:
		form = forms.CustomerRegisterForm(request.form)
		if request.method == 'POST' and form.validate():
			users.add_user(email=form.email.data,
				password_hash=generate_password_hash(form.password.data),
				first_name=form.first_name.data,
				last_name=form.last_name.data,
				organization=form.organization.data,
				phone=form.phone.data,
				messenger_type=form.messenger_type.data,
				messenger_uid=form.messenger_uid.data,
				referrer_id=referrer.id)
			user = users.get_user_by_email(form.email.data, full=True)
			if user:
				users.add_user_role(user.id, roles.CUSTOMER)
				user.roles.append(roles.CUSTOMER)
				session['user_id'] = user.id
				session['ref'] = ''
				tmail.user_confirm_email(user)
				flash(u'Вы успешно зарегистрированы. На указанный электронный адрес'
					u' было выслано письмо с подтверждением.', 'success')
				return redirect(url_for('cabinet.index'))
			flash(u'Произошла ошибка при регистрации. Обратитесь к администрации.', 'error')
	
	return render_template('site/register-customer.html', form=form)