Skip to content

Commit

Permalink
Created register html page
Browse files Browse the repository at this point in the history
  • Loading branch information
gayu-thri committed Mar 10, 2020
1 parent 1c847d5 commit eddea81
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 5 deletions.
8 changes: 6 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,22 @@ def home():
return render_template('login.html')

@app.route('/login', methods=['POST'])
def do_admin_login():
def do_login():
temp = -1
username = request.form['uname']
password = request.form['pass']
for i in crendentials:
if username in crendentials[i]['username'] and password in crendentials[i]['password']:
temp += 1
session['logged in'] = True
session['logged_in'] = True
return "Logged In"
if temp == -1:
return "Invalid"

@app.route('/register',methods=['POST'])
def do_register(): ##HAVE TO FINISH
return render_template('login.html')

@app.route('/error')
def err():
flash("Wrong password entered")
Expand Down
6 changes: 3 additions & 3 deletions templates/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.8.0/css/bulma.min.css">
<link rel="stylesheet" type= "text/css" href="{{ url_for('static', filename='css/main.css') }}">
<title>Login</title>
<title>CAMs--Login</title>
</head>
<body>
<nav>
Expand All @@ -13,12 +13,12 @@
<div class="has-text-centered block">
<form action="http://127.0.0.1:5000/login" method="POST">
<h2 class="is-size-2">LOGIN</h2>
<input type="email" placeholder="Email Id" name="uname" required>
<input type="text" placeholder="Username" name="uname" required>
<input type="password" placeholder="Password" name="pass" required>
<div ></div>
<button type="submit">LOGIN</button>
<div class="register">
<p>Need an account? <a href="#">Sign up</a></p>
<p>Need an account? <a href="register">Sign up</a></p>
</div>
</form>
</div>
Expand Down
26 changes: 26 additions & 0 deletions templates/register.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.8.0/css/bulma.min.css">
<link rel="stylesheet" type= "text/css" href="{{ url_for('static', filename='css/main.css') }}">
<title>CAMs--Register</title>
</head>
<body>
<nav>
<p class="has-text-centered">Navbar here</p>
</nav>
<div class="has-text-centered block">
<form action="http://127.0.0.1:5000/register" method="POST">
<h2 class="is-size-2">SIGN UP HERE</h2>
<input type="text" placeholder="Username" name="uname" required>
<input type="password" placeholder="Password" name="pass" required>
<div ></div>
<button type="submit">REGISTER</button>
<div class="login">
<p>Go back to login page<a href="login">Login</a></p>
</div>
</form>
</div>
</body>
</html>

0 comments on commit eddea81

Please sign in to comment.