コード例 #1
0
ファイル: app.py プロジェクト: seanziegler/amazonvenv
def track():	
	if request.method == 'POST':
		alertPrice = request.form['alertPrice']	
		email = request.form['email']
		phoneNumber = request.form['phone']
		currency = 'USD'
		try:
			mySQLconnect()
			cursor.execute('INSERT INTO alerts(asin, currency, alertprice, uid) VALUES(%s,%s,%s,%s)',(ASIN, currency, alertPrice, uid))
			db.commit()
			mySQLdisconnect()
			flash('Your alert has been added')
			sendConfirmmessage(phoneNumber, twilioPhoneNumber)
		except:
			flash('Oops, The database is not availible. Please try again later.')	
		return redirect('/')
コード例 #2
0
ファイル: app.py プロジェクト: seanziegler/amazonvenv
def login():
	if request.method == 'POST':
		username = request.method['username']
		password = request.method['password']
		try:
			mySQLconnect()
			cursor.execute('SELECT password FROM users WHERE username = %s', (username,))
		except:
			flash('Oops, The database is not availible. Please try again later.')
			return redirect('/')
		if bcrypt.verify(password):
			print('success')
		else:
			print('wrong passwrd')
		mySQLdisconnect()
		return redirect('index.html')
	return render_template('login.html')