-
-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding a basic login system to Puppetboard
- Loading branch information
Rob Reus
committed
Apr 30, 2018
1 parent
5023d4c
commit 1c96640
Showing
11 changed files
with
334 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from puppetboard.core import get_app | ||
from flask_sqlalchemy import SQLAlchemy | ||
import datetime | ||
|
||
|
||
app = get_app() | ||
db = SQLAlchemy(app) | ||
|
||
|
||
class Users(db.Model): | ||
created = db.Column(db.DateTime, default=datetime.datetime.now, nullable=False) | ||
modified = db.Column(db.DateTime, default=datetime.datetime.now, | ||
onupdate=datetime.datetime.now, nullable=False) | ||
id = db.Column(db.Integer, unique=True, primary_key=True, nullable=False) | ||
username = db.Column(db.String(80), unique=True, nullable=False) | ||
password = db.Column(db.String(80), nullable=False) | ||
|
||
def __repr__(self): | ||
return '{}/{}/{}'.format(self.id, self.username, self.password) | ||
|
||
def is_authenticated(self): | ||
return True | ||
|
||
def is_active(self): | ||
return True | ||
|
||
def is_anonymous(self): | ||
return False | ||
|
||
def get_id(self): | ||
return self.id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.