aboutsummaryrefslogtreecommitdiff
path: root/src/web/models
diff options
context:
space:
mode:
authorFrançois Schmidts <francois.schmidts@gmail.com>2015-10-11 23:34:33 +0200
committerFrançois Schmidts <francois.schmidts@gmail.com>2016-01-26 23:46:31 +0100
commit5f66e6465d3822b150898de2a7fb8df39ed7fdc6 (patch)
tree394948060f5cff75de651b65b2a6509608c8ac60 /src/web/models
parenta bit of cleaning, putting code where it belongs (diff)
downloadnewspipe-5f66e6465d3822b150898de2a7fb8df39ed7fdc6.tar.gz
newspipe-5f66e6465d3822b150898de2a7fb8df39ed7fdc6.tar.bz2
newspipe-5f66e6465d3822b150898de2a7fb8df39ed7fdc6.zip
removing misplaced stuffs from views, more controllers use
Diffstat (limited to 'src/web/models')
-rw-r--r--src/web/models/user.py10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/web/models/user.py b/src/web/models/user.py
index c5e70036..d1b9c568 100644
--- a/src/web/models/user.py
+++ b/src/web/models/user.py
@@ -30,7 +30,7 @@ import re
import random
import hashlib
from datetime import datetime
-from werkzeug import generate_password_hash, check_password_hash
+from werkzeug import check_password_hash
from flask.ext.login import UserMixin
from bootstrap import db
@@ -63,12 +63,6 @@ class User(db.Model, UserMixin):
"""
return self.id
- def set_password(self, password):
- """
- Hash the password of the user.
- """
- self.pwdhash = generate_password_hash(password)
-
def check_password(self, password):
"""
Check the password of the user.
@@ -79,7 +73,7 @@ class User(db.Model, UserMixin):
"""
Return True if the user has administrator rights.
"""
- return len([role for role in self.roles if role.name == "admin"]) != 0
+ return "admin" in [role.name for role in self.roles]
def __eq__(self, other):
return self.id == other.id
bgstack15