-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprofile.py
More file actions
29 lines (23 loc) · 884 Bytes
/
profile.py
File metadata and controls
29 lines (23 loc) · 884 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
def index():
if request.method == 'GET':
return render_template('index.html')
@app.route("/login", methods=['GET','POST'])
def login():
if request.method == 'GET':
return render_template('login.html')
elif request.method == 'POST':
varusername=request.form['eusername']
varpassword=request.form['epassword']
profiles = json.load(open('profiles.json'))
print profiles['profiles']
for profile in profiles['profiles']:
print(profile)
if varusername== "Admin" and varpassword== 'Stanky123':
return redirect(url_for('show_all'))
elif profile['cusername'] == varusername and profile['cpassword'] == varpassword:
return redirect(url_for('getprofile',foruser=profile['cusername']))
return "Wrong password"
@app.route("/show_all")
def show_all():
ctable = json.load(open('profiles.json'))
return render_template('show_all.html',allprofiles=ctable)