Merge branch 'bs4login'

This commit is contained in:
SecretlyTaco 2018-02-22 20:35:06 +00:00
commit 5cfc400a8b
4 changed files with 44 additions and 186 deletions

View file

@ -30,6 +30,8 @@ def login():
status=login_attempt['status'], status=login_attempt['status'],
message=login_attempt['message']) message=login_attempt['message'])
elif request.method == 'GET': elif request.method == 'GET':
if 'username' in session.keys():
return redirect(url_for('logout'))
return render_template('login.html') return render_template('login.html')
@ -51,6 +53,8 @@ def register():
status="danger", status="danger",
message="Passwords do not match!") message="Passwords do not match!")
elif request.method == 'GET': elif request.method == 'GET':
if 'username' in session.keys():
return redirect(url_for('logout'))
return render_template('register.html') return render_template('register.html')

View file

@ -1,19 +1,19 @@
body { body {
padding-top: 90px; padding-top: 90px;
} }
.panel-login { .card-login {
border-color: #ccc; border-color: #ccc;
-webkit-box-shadow: 0px 2px 3px 0px rgba(0,0,0,0.2); -webkit-box-shadow: 0px 2px 3px 0px rgba(0,0,0,0.2);
-moz-box-shadow: 0px 2px 3px 0px rgba(0,0,0,0.2); -moz-box-shadow: 0px 2px 3px 0px rgba(0,0,0,0.2);
box-shadow: 0px 2px 3px 0px rgba(0,0,0,0.2); box-shadow: 0px 2px 3px 0px rgba(0,0,0,0.2);
} }
.panel-login>.panel-heading { .card-login>.card-heading {
color: #00415d; color: #00415d;
background-color: #fff; background-color: #fff;
border-color: #fff; border-color: #fff;
text-align:center; text-align:center;
} }
.panel-login>.panel-heading a{ .card-login>.card-heading a{
text-decoration: none; text-decoration: none;
color: #666; color: #666;
font-weight: bold; font-weight: bold;
@ -22,11 +22,11 @@ body {
-moz-transition: all 0.1s linear; -moz-transition: all 0.1s linear;
transition: all 0.1s linear; transition: all 0.1s linear;
} }
.panel-login>.panel-heading a.active{ .card-login>.card-heading a.active{
color: #029f5b; color: #029f5b;
font-size: 18px; font-size: 18px;
} }
.panel-login>.panel-heading hr{ .card-login>.card-heading hr{
margin-top: 10px; margin-top: 10px;
margin-bottom: 0px; margin-bottom: 0px;
clear: both; clear: both;
@ -37,7 +37,7 @@ body {
background-image: -ms-linear-gradient(left,rgba(0,0,0,0),rgba(0,0,0,0.15),rgba(0,0,0,0)); background-image: -ms-linear-gradient(left,rgba(0,0,0,0),rgba(0,0,0,0.15),rgba(0,0,0,0));
background-image: -o-linear-gradient(left,rgba(0,0,0,0),rgba(0,0,0,0.15),rgba(0,0,0,0)); background-image: -o-linear-gradient(left,rgba(0,0,0,0),rgba(0,0,0,0.15),rgba(0,0,0,0));
} }
.panel-login input[type="text"],.panel-login input[type="email"],.panel-login input[type="password"] { .card-login input[type="text"],.card-login input[type="email"],.card-login input[type="password"] {
height: 45px; height: 45px;
border: 1px solid #ddd; border: 1px solid #ddd;
font-size: 16px; font-size: 16px;
@ -45,8 +45,8 @@ body {
-moz-transition: all 0.1s linear; -moz-transition: all 0.1s linear;
transition: all 0.1s linear; transition: all 0.1s linear;
} }
.panel-login input:hover, .card-login input:hover,
.panel-login input:focus { .card-login input:focus {
outline:none; outline:none;
-webkit-box-shadow: none; -webkit-box-shadow: none;
-moz-box-shadow: none; -moz-box-shadow: none;

View file

@ -1,94 +1,20 @@
<!DOCTYPE html> {% extends 'layout.html' %}
<html lang="en"> {% block content %}
<head>
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename = 'bootstrap.min.css') }}" />
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename = 'index.css') }}" />
<meta charset="UTF-8">
<title>Welcome to Tweeder!</title>
</head>
<body>
<div class="container"> <div class="container">
{% if status %} {% if status %}
<div class="alert alert-{{ status }}" role="alert">{{ message }}</div> <div class="alert alert-{{ status }}" role="alert">{{ message }}</div>
{% endif %} {% endif %}
<div class="row"> <div class="card col-xl-6 col-md-8 col-sm-10 col-xs-12 mx-auto">
<div class="col-md-6 col-md-offset-3"> <div class="card-body">
<div class="panel panel-login"> <h2 class="mx-auto" style="display:inline;">Login to Tweeder</h2>
<div class="panel-heading"> <a href="/register" class="btn btn-outline-success" style="float:right;">Need an account?</a>
<div class="row"> <form method="POST" action="/login" class="form-group">
<div class="col-xs-6"> <input name="username" type="text" class="form-control" style="margin-bottom: 12px; margin-top: 12px; height:45px;" tabindex="1" placeholder="Username or email address" />
<a href="#" class="active" id="login-form-link">Login</a> <input name="password" type="password" class="form-control" style="margin-bottom: 12px; height:45px;" tabindex="2" placeholder="Password" />
</div> <input type="submit" class="form-control btn btn-primary" />
<div class="col-xs-6"> </form>
<a href="#" id="register-form-link">Register</a> </div>
</div> </div>
</div> </div>
<hr>
</div>
<div class="panel-body">
<div class="row">
<div class="col-lg-12">
<form id="login-form" action="login" method="POST" role="form" style="display: block;">
<div class="form-group">
<input type="text" name="username" id="username" tabindex="1" class="form-control" placeholder="Username or email address" value="">
</div>
<div class="form-group">
<input type="password" name="password" id="password" tabindex="2" class="form-control" placeholder="Password">
</div>
<div class="form-group text-center">
<input type="checkbox" tabindex="3" class="" name="remember" id="remember">
<label for="remember"> Remember Me</label>
</div>
<div class="form-group">
<div class="row">
<div class="col-sm-6 col-sm-offset-3">
<input type="submit" name="login-submit" id="login-submit" tabindex="4" class="form-control btn btn-login" value="Log In">
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-lg-12">
<div class="text-center">
<a href="/recover" tabindex="5" class="forgot-password">Forgot Password?</a>
</div>
</div>
</div>
</div>
</form>
<form id="register-form" action="/register" method="POST" role="form" style="display: none;">
<div class="form-group">
<input type="text" name="username" id="username" tabindex="1" class="form-control" placeholder="Username" value="">
</div>
<div class="form-group">
<input type="email" name="email" id="email" tabindex="1" class="form-control" placeholder="Email Address" value="">
</div>
<div class="form-group">
<input type="password" name="password" id="password" tabindex="2" class="form-control" placeholder="Password">
</div>
<div class="form-group">
<input type="password" name="confirm-password" id="confirm-password" tabindex="2" class="form-control" placeholder="Confirm Password" oninput="check(this)">
</div>
<div class="form-group">
<div class="row">
<div class="col-sm-6 col-sm-offset-3">
<input type="submit" name="register-submit" id="register-submit" tabindex="4" class="form-control btn btn-register" value="Register Now">
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="{{ url_for('static', filename = 'jquery-3.2.1.min.js') }}"></script> {% endblock %}
<script src="{{ url_for('static', filename = 'bootstrap.min.js') }}" ></script>
<script src="{{ url_for('static', filename = 'index.js') }}" ></script>
</body>
</html>

View file

@ -1,94 +1,22 @@
<!DOCTYPE html> {% extends 'layout.html' %}
<html lang="en"> {% block content %}
<head>
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename = 'bootstrap.min.css') }}" />
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename = 'index.css') }}" />
<meta charset="UTF-8">
<title>Welcome to Tweeder!</title>
</head>
<body>
<div class="container"> <div class="container">
{% if status %} {% if status %}
<div class="alert alert-{{ status }}" role="alert">{{ message }}</div> <div class="alert alert-{{ status }}" role="alert">{{ message }}</div>
{% endif %} {% endif %}
<div class="row"> <div class="card col-xl-6 col-md-8 col-sm-10 col-xs-12 mx-auto">
<div class="col-md-6 col-md-offset-3"> <div class="card-body">
<div class="panel panel-login"> <h2 class="mx-auto" style="display:inline;">Register for Tweeder</h2>
<div class="panel-heading"> <a href="/login" class="btn btn-outline-primary" style="float:right;">Have an account?</a>
<div class="row"> <form method="POST" action="/register" class="form-group">
<div class="col-xs-6"> <input name="username" type="text" class="form-control" style="margin-bottom: 12px; margin-top: 12px; height:45px;" tabindex="1" placeholder="Username" />
<a href="#" id="login-form-link">Login</a> <input name="email" type="text" class="form-control" style="margin-bottom: 12px; margin-top: 12px; height:45px;" tabindex="2" placeholder="Email address" />
</div> <input name="password" type="password" class="form-control" style="margin-bottom: 12px; height:45px;" tabindex="3" placeholder="Password" />
<div class="col-xs-6"> <input name="confirm-password" type="password" class="form-control" style="margin-bottom: 12px; height:45px;" tabindex="4" placeholder="Confirm Password" />
<a href="#" class="active" id="register-form-link">Register</a> <input type="submit" class="form-control btn btn-success" />
</div> </form>
</div> </div>
<hr> </div>
</div> </div>
<div class="panel-body">
<div class="row">
<div class="col-lg-12">
<form id="login-form" action="login" method="POST" role="form" style="display: none;">
<div class="form-group">
<input type="text" name="username" id="username" tabindex="1" class="form-control" placeholder="Username or email address" value="">
</div>
<div class="form-group">
<input type="password" name="password" id="password" tabindex="2" class="form-control" placeholder="Password">
</div>
<div class="form-group text-center">
<input type="checkbox" tabindex="3" class="" name="remember" id="remember">
<label for="remember"> Remember Me</label>
</div>
<div class="form-group">
<div class="row">
<div class="col-sm-6 col-sm-offset-3">
<input type="submit" name="login-submit" id="login-submit" tabindex="4" class="form-control btn btn-login" value="Log In">
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-lg-12">
<div class="text-center">
<a href="/recover" tabindex="5" class="forgot-password">Forgot Password?</a>
</div>
</div>
</div>
</div>
</form>
<form id="register-form" action="/register" method="POST" role="form" style="display: block;">
<div class="form-group">
<input type="text" name="username" id="username" tabindex="1" class="form-control" placeholder="Username" value="">
</div>
<div class="form-group">
<input type="email" name="email" id="email" tabindex="1" class="form-control" placeholder="Email Address" value="">
</div>
<div class="form-group">
<input type="password" name="password" id="password" tabindex="2" class="form-control" placeholder="Password">
</div>
<div class="form-group">
<input type="password" name="confirm-password" id="confirm-password" tabindex="2" class="form-control" placeholder="Confirm Password" oninput="check(this)">
</div>
<div class="form-group">
<div class="row">
<div class="col-sm-6 col-sm-offset-3">
<input type="submit" name="register-submit" id="register-submit" tabindex="4" class="form-control btn btn-register" value="Register Now">
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="{{ url_for('static', filename = 'jquery-3.2.1.min.js') }}"></script> {% endblock %}
<script src="{{ url_for('static', filename = 'bootstrap.min.js') }}" ></script>
<script src="{{ url_for('static', filename = 'index.js') }}" ></script>
</body>
</html>