예제 #1
0
파일: index.py 프로젝트: lhang/TDOA
	def POST(self):
		user = web.input().user
		#md5加密存储密码
		passwd = data.md5(web.input().passwd)
		ident = data.checkin(user)
		checkcode = web.input().checkcode
		try:
			if checkcode != session.checkcode:
				session.login = 0
				return render_template(type=0,template_name='login.html',error="验证码错误")

			elif len(ident)==0 :
				session.login = 0
				return render_template(type=0,template_name='login.html',error="用户名不存在")
			elif passwd == ident[0]['account_password']:
				session.login = 1
				session.user = user
				session.type = ident[0]['account_name']
				return json.dumps({"statusCode":"200", "message":"登录成功", "callbackType":"closeCurrent"})
			else:
				session.login = 0
				return render_template(type=0,template_name='login.html',error="密码错误")
		except:
			session.login = 0
			return render_template(type=0,template_name='login.html',error="系统错误")
예제 #2
0
파일: index.py 프로젝트: lhang/TDOA
	def POST(self):
		user = web.input().user
		#md5加密存储密码
		passwd = data.md5(web.input().passwd)
		ident = data.checkin(user)
		checkcode = web.input().checkcode

		try:
			if checkcode != session.checkcode:
				session.login = 0
				return render_template(type=0,template_name='login.html',error="验证码错误")
			elif len(ident)==0 :
				session.login = 0
				return render_template(type=0,template_name='login.html',error="用户名不存在")
			elif passwd == ident[0]['account_password']:
				session.login = 1
				session.user = user
				session.type = ident[0]['account_name']
				return render_template(type=session.type,template_name='index.html',user=session.user)
			else:
				session.login = 0
				return render_template(type=0,template_name='login.html',error="密码错误")
		except Exception, e:
			print 'login error', e
			session.login = 0
			return render_template(type=0,template_name='login.html',error="系统错误")
예제 #3
0
파일: index.py 프로젝트: haohy/TDOA
	def POST(self):
		user = web.input().user
		#md5加密存储密码
		passwd = data.md5(web.input().passwd)
		ident = data.checkin(user)
		checkcode = web.input().checkcode
		try:
			if checkcode != session.checkcode:
				session.login = 0
				return render_template(type=0,template_name='login.html',error="验证码错误")

			elif len(ident)==0 :
				session.login = 0
				return render_template(type=0,template_name='login.html',error="用户名不存在")
			elif passwd == ident[0]['account_password']:
				session.login = 1
				session.user = user
				session.type = ident[0]['account_name']
				return json.dumps({"statusCode":"200", "message":"登录成功", "callbackType":"closeCurrent"})
			else:
				session.login = 0
				return render_template(type=0,template_name='login.html',error="密码错误")
		except:
			session.login = 0
			return render_template(type=0,template_name='login.html',error="系统错误")
예제 #4
0
파일: account.py 프로젝트: haohy/TDOA
def save_info(user, args):
	c = data.SQLconn()
	conn = MySQLdb.connect(host=c["host"], user=c["user"], passwd=c["passwd"], charset=c["charset"], db=c["db"])
	cursor = conn.cursor(cursorclass = MySQLdb.cursors.DictCursor)
	cursor.execute("update ACCOUNT SET \
					account_username='******', \
					account_sex = '%s',\
					account_phone='%s', \
					account_email='%s', \
					account_address = '%s'\
					WHERE account_id = %s\
					;"% (args.username, args.account_sex,args.phone,\
					args.email,str(args.account_address).encode('utf-8'), args.id))
	conn.commit()
	if args.get('oldpasswd'):
		if args.get('newpassword1') == args.get('newpassword2'):
			passwd = data.checkin(user)
			newpassword1 = data.md5(args.get('newpassword1'))
			oldpasswd = data.md5(args.get('oldpasswd'))
			if oldpasswd == passwd[0]['account_password']:
				cursor.execute("update ACCOUNT SET \
						account_password = '******'\
						WHERE account_id = '%s'"\
						%(newpassword1, args.get('id')))
				conn.commit()
			else:
				return False
		else:
			return False
	conn.close()
	return True
예제 #5
0
파일: index.py 프로젝트: haohy/TDOA
	def POST(self):
		user = web.input().user
		#md5加密存储密码
		passwd = data.md5(web.input().passwd)
		ident = data.checkin(user)
		checkcode = web.input().checkcode

		try:
			if checkcode != session.checkcode:
				session.login = 0
				return render_template(type=0,template_name='login.html',error="验证码错误")
			elif len(ident)==0 :
				session.login = 0
				return render_template(type=0,template_name='login.html',error="用户名不存在")
			elif passwd == ident[0]['account_password']:
				session.login = 1
				session.user = user
				session.type = ident[0]['account_name']
				return render_template(type=session.type,template_name='index.html',user=session.user)
			else:
				session.login = 0
				return render_template(type=0,template_name='login.html',error="密码错误")
		except Exception, e:
			print 'login error', e
			session.login = 0
			return render_template(type=0,template_name='login.html',error="系统错误")