From 5428756a85dda00a413c8a678fa38b70ce008ddc Mon Sep 17 00:00:00 2001 From: Deepti Date: Sun, 27 Nov 2016 10:04:24 +0530 Subject: [PATCH] Modified restapi --- restapi.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/restapi.py b/restapi.py index b741567..c12c6be 100644 --- a/restapi.py +++ b/restapi.py @@ -2,7 +2,7 @@ import MicroRegClient except: from micro_reg_mod import MicroRegClient - +import requests from flask import Flask, request, url_for, render_template, flash, redirect import json from cred import username,token @@ -153,15 +153,23 @@ def front(): @app.route("/landing_page",methods=["POST"]) def land(): - print request.method + # print request.method data = request.form - print data + # print data user = data["username"] pswd = data["password"] + # print user,pswd if user == username and pswd == token : + global auth_dict + auth_dict["username"] = user + auth_dict["token"] = token + auth_dict["timestamp"] = datetime.now() + # return json.dumps({"status":1}) #success return render_template("index.html") else: - flash("Incorrect Username or Password") + # return json.dumps({"status":0}) #failure + return flash("Unsuccessful attempt") + if __name__ == '__main__': t1=Thread(target=timeout)