예제 #1
0
def editUsername(username):
	#changes the username and/or password as long as they meet requirements
	if session['logged_in']:#verify logged in
		if request.method=="POST":
			changeState=idea_box.changeUsername(session['username'],request.form['newUsername'].lower())
			if changeState==1:	#see if we can change it
				session['username']=request.form['newUsername'].lower()
				flash("Username Changed")
				return redirect(url_for("welcome"))
			else: flash(changeState)

		else: return render_template("editUsername.html",username=session['username'])
	else: return redirect(url_for('welcome'))
예제 #2
0
def changeUname():
	#this ufnction changes the password
	try:
		#create a new use with a randomly generated username
		print "Attempting Username change"
		session=idea_box.createAll()
		username="******".lower()
		newUsername="******".lower()
		if idea_box.changeUsername(username,newUsername,session):
			print "Username changed"
		else: print "Username not changed"
		session.close()
	except:
		print "Username change error"
		raise
	else:
		print "Username change error free"
		outputUser(newUsername.lower())