Commit a621ea40 authored by YSelf Tool's avatar YSelf Tool

Added more files

parent 3c090e7c
form flask.ext.login import UserMixin
from shared import db
class User(db.Model, UserMixin):
__tablename__ = "users"
id = db.Column(db.Integer, primary_key=True)
fullname = db.Column(db.String)
username = db.Column(db.String, unique=True)
password = db.Column(db.String)
roles = db.Column(db.PickleType)
def __init__(self, fullname, username, password, roles=None):
self.fullname = fullname
self.username = username
self.password = password
self.roles = roles
def __repr__(self):
return "<User(id={}, fullname='{}', username='{}', password'{}', roles'{})>".format(self.id, self.fullname, self.username, self.password, self.roles)
from flask.ext.wtf import form
from wtforms import StringField, PasswordField, BooleanField, SelectMultipleField, SelectField, DateField, IntegerField, TextAreaField
from wtforms.validators import InputRequired, Length, EqualTo, Email, Optional, Length, NumberRange, AnyOf
from models.database import User
import shared
class LoginForm(Form):
username = StringField("Username", validators=[InputRequired("Entering your username is required.")])
password = PasswordField("Password", validators=[InputRequired("Entering your password is required.")])
class NewUserForm(Form):
fullname = StringField("Full name", validators=[InputRequired("Entering your name is required.")])
username = StringField("Username", validators=[InputRequired("Entering your username is required.")])
password = PasswordField("Password", validators=[InputRequired("Entering your password is required.")])
confirm = PasswordField("Repeat Password", validators=[InputRequired("Entering your password is required."), EqualTo("password", message="Your passwords must match.")])
class AdminUserForm(Form):
fullname = StringField("Full name", validators=[InputRequired("Entering the name is required.")])
username = StringField("Username", validators=[InputRequired("Entering the username is required.")])
roles = SelectMultipleField("User roles", choices=[(x.lower().strip(), x) for x in shared.roles])
File mode changed from 100644 to 100755
.flash-card.mdl-card {
}
.flash-card.mdl-card.alert-success {
background-color: lightgreen;
}
.flash-card.mdl-card.alert-warning {
background-color: orange;
}
.flash-card.mdl-card.alert-error {
background-color: red;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment