def login(): error = None if request.method == 'POST': username = request.form['username'] password = request.form['password'] if db.check_password(username, password): session['username'] = username return redirect(url_for('home')) else: session.clear() error = 'Invalid Credentials. Please try again.' return render_template('login.html', error=error)
def post(self): args = parser.parse_args() data = { "username": args["username"], "password": args["password"] } if db.check_password(data): if db.delete_user(data): res = { "message": "Success" } return jsonify(**res) return jsonify("Fail")
def post(self): args = parser.parse_args() data = { "username": args["username"], "password": args["password"] } if db.check_password(data): api_key = db.get_api_key(data) res = { "message": "Success", "api_key": api_key } return jsonify(**res) return jsonify("Fail")
def test_check_password(self): res = db.check_password(user_test_data) self.assertTrue(res)