Skip to content

Commit

Permalink
Revert "Add "Alternative Token" handling for flask-login (see #699)" (#…
Browse files Browse the repository at this point in the history
…705)

* Revert "chore(package): update browser-sync to version 2.18.13 (#700)"

This reverts commit 0cfbac4.

* Revert "chore(package): update uglify-js to version 3.0.25 (#697)"

This reverts commit e9633cb.

* Revert "Add "Alternative Token" handling for flask-login (see #699) (#701)"

This reverts commit d01874c.
  • Loading branch information
lipis committed Aug 10, 2017
1 parent 0cfbac4 commit 9e76257
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
7 changes: 3 additions & 4 deletions main/auth/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def key(self):
return self.user_db.key.urlsafe()

def get_id(self):
return unicode(self.user_db.session_token)
return self.user_db.key.urlsafe()

def is_authenticated(self):
return True
Expand All @@ -73,8 +73,8 @@ def has_permission(self, permission):


@login_manager.user_loader
def load_user(session_token):
user_db = model.User.get_by('session_token', session_token)
def load_user(key):
user_db = ndb.Key(urlsafe=key).get()
if user_db:
return FlaskUser(user_db)
return None
Expand Down Expand Up @@ -395,7 +395,6 @@ def create_user_db(auth_id, name, username, email='', verified=False, **props):
auth_ids=[auth_id] if auth_id else [],
verified=verified,
token=util.uuid(),
session_token=util.uuid(),
**props
)
user_db.put()
Expand Down
2 changes: 0 additions & 2 deletions main/control/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ def user_reset(token=None):
form = UserResetForm()
if form.validate_on_submit():
user_db.password_hash = util.password_hash(user_db, form.new_password.data)
user_db.session_token = util.uuid()
user_db.token = util.uuid()
user_db.verified = True
user_db.put()
Expand Down Expand Up @@ -262,7 +261,6 @@ def user_activate(token):
if form.validate_on_submit():
form.populate_obj(user_db)
user_db.password_hash = util.password_hash(user_db, form.password.data)
user_db.session_token = util.uuid()
user_db.token = util.uuid()
user_db.verified = True
user_db.put()
Expand Down
1 change: 0 additions & 1 deletion main/model/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class User(model.Base):
verified = ndb.BooleanProperty(default=False)
token = ndb.StringProperty(default='')
password_hash = ndb.StringProperty(default='')
session_token = ndb.StringProperty(default='')

def has_permission(self, perm):
return self.admin or perm in self.permissions
Expand Down

0 comments on commit 9e76257

Please sign in to comment.