Update login.py
This commit is contained in:
parent
a6567c0ecb
commit
1945dbe65c
50
login.py
50
login.py
@ -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 %}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user