Skip to content

Commit

Permalink
Login Added
Browse files Browse the repository at this point in the history
  • Loading branch information
bhardwajaditya committed Oct 13, 2018
1 parent 802ba21 commit 994c187
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 1 deletion.
52 changes: 51 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import datetime
import csv
import diagnosisClient
from googlesearch import search
from commons import json_response

client = MongoClient()
Expand All @@ -23,7 +24,6 @@
diagnosis = diagnosisClient.DiagnosisClient(username, password, authUrl, language, healthUrl)



@app.route('/')
def index():
return '<h1>Welcome to Medisyst!</h1>'
Expand Down Expand Up @@ -78,5 +78,55 @@ def generate():
rawHashString = hmac.new(bytes(x, encoding='utf-8'), x.encode('utf-8')).digest()
computedHashString = base64.b64encode(rawHashString).decode()
return computedHashString

@app.route('/signup')
def signup():
email=request.args.get('email')
password=request.args.get('password')
aadhaar = request.args.get('aadhaar')
gender = request.args.get('gender')
fname = request.args.get('fname')
lname =request.args.get('lname')
dob = request.args.get('dob')
A=[]
x=users.find({"email":email})
for i in x:
A.append(x)
if(len(A)==0):
user={
"email":email,
"password":password,
"aadhaar":aadhaar,
"gender":gender,
"fname":fname,
"lname":lname,
"dob":dob
}
x=users.insert_one(user)
print(x)
return "yes"
else:
return 'no'

@app.route('/login')
def signin():
email=request.args.get('email')
password=request.args.get('password')
A=[]
x=users.find_one({"email":email})
print(x)
if(x['password']==password):
return "yes"
else:
return "no"

@app.route('/search')
def gsearch():
query = request.args.get('query')
A=[]
for j in search(query, num=10, stop=1):
A.append(j)
return json_response(A)

if __name__ == '__main__':
app.run( host=os.environ['IP'], port=os.environ['PORT'] ,debug=True)
Empty file added static/css/style.css
Empty file.
Empty file added static/js/script.js
Empty file.
Empty file added templates/index.html
Empty file.

0 comments on commit 994c187

Please sign in to comment.