Ejemplo n.º 1
0
def register():
	if request.method=='POST':
		#check if the usrname is valid, if so create it and send to welcoem page
		#check username
		userCheck=idea_box.usernameCheck(request.form['regUsername'])
		if userCheck==1: #username is ok
			if len(request.form['regPassword'])>=10 and len(request.form['regPassword'])<=50:
				if request.form['regPassword']==request.form['passwordConfirm']:#password ok
					#create this bad mother
					if idea_box.createUser(request.form['regUsername'].lower(),request.form['regPassword']):
						flash("Registration successful! Welcome to the fold %s"%request.form['regUsername'])
						return redirect(url_for('welcome'))
					else: flash("SQL ERROR")
				else: flash("Passwords don't match")
			else: flash("10-50 Characters for the password")
		else: flash(userCheck)
	return render_template("register.html")
Ejemplo n.º 2
0
def newUser():
	#this function creats a new user
	try:
		#create a new use with a randomly generated username
		print "Attempting New User Creation"
		session=idea_box.createAll()
		username="******"
		password="******"
		if idea_box.createUser(username,password,session):
			print "User Created"
		else: print "User not Created"
		session.close()
	except:
		print "User Creation Error"
		raise
	else:
		print "User Creation Error Free"
		outputUser(username.lower())