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">
|
||||
{% block body %}
|
||||
{% if session['logged_in'] %}
|
||||
<p>You're logged in already!</p>
|
||||
{% else %}
|
||||
from sqlalchemy import *
|
||||
from sqlalchemy import create_engine, ForeignKey
|
||||
from sqlalchemy import Column, Date, Integer, String
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
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">
|
||||
<div class="login-screen">
|
||||
<div class="app-title">
|
||||
<h1>Login</h1>
|
||||
</div>
|
||||
########################################################################
|
||||
class User(Base):
|
||||
""""""
|
||||
__tablename__ = "users"
|
||||
|
||||
<div class="login-form">
|
||||
<div class="control-group">
|
||||
<input type="text" class="login-field" value="" placeholder="username" name="username">
|
||||
<label class="login-field-icon fui-user" for="login-name"></label>
|
||||
</div>
|
||||
id = Column(Integer, primary_key=True)
|
||||
username = Column(String)
|
||||
password = Column(String)
|
||||
|
||||
<div class="control-group">
|
||||
<input type="password" class="login-field" value="" placeholder="password" name="password">
|
||||
<label class="login-field-icon fui-lock" for="login-pass"></label>
|
||||
</div>
|
||||
#----------------------------------------------------------------------
|
||||
def __init__(self, username, password):
|
||||
""""""
|
||||
self.username = username
|
||||
self.password = password
|
||||
|
||||
<input type="submit" value="Log in" class="btn btn-primary btn-large btn-block" >
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
# create tables
|
||||
Base.metadata.create_all(engine)
|
||||
|
Loading…
Reference in New Issue
Block a user