Update login.py

This commit is contained in:
Logan Hunt 2018-03-27 09:30:24 -06:00 committed by GitHub
parent a6567c0ecb
commit 1945dbe65c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,34 +1,26 @@
<link rel="stylesheet" href="/static/style.css" type="text/css"> from sqlalchemy import *
{% block body %} from sqlalchemy import create_engine, ForeignKey
{% if session['logged_in'] %} from sqlalchemy import Column, Date, Integer, String
<p>You're logged in already!</p> from sqlalchemy.ext.declarative import declarative_base
{% else %} from sqlalchemy.orm import relationship, backref
engine = create_engine('sqlite:///tutorial.db', echo=True)
Base = declarative_base()
<form action="/login" method="POST"> ########################################################################
<div class="login"> class User(Base):
<div class="login-screen"> """"""
<div class="app-title"> __tablename__ = "users"
<h1>Login</h1>
</div>
<div class="login-form"> id = Column(Integer, primary_key=True)
<div class="control-group"> username = Column(String)
<input type="text" class="login-field" value="" placeholder="username" name="username"> password = Column(String)
<label class="login-field-icon fui-user" for="login-name"></label>
</div>
<div class="control-group"> #----------------------------------------------------------------------
<input type="password" class="login-field" value="" placeholder="password" name="password"> def __init__(self, username, password):
<label class="login-field-icon fui-lock" for="login-pass"></label> """"""
</div> self.username = username
self.password = password
<input type="submit" value="Log in" class="btn btn-primary btn-large btn-block" > # create tables
<br> Base.metadata.create_all(engine)
</div>
</div>
</div>
</form>
{% endif %}
{% endblock %}