[Plugin] auth_plain: Implemented Avatar
This commit is contained in:
parent
28865649b4
commit
88ff46c193
|
@ -6,7 +6,7 @@ Flaschengeist database (as User attribute)
|
|||
import os
|
||||
import hashlib
|
||||
import binascii
|
||||
from werkzeug.exceptions import BadRequest
|
||||
from werkzeug.exceptions import BadRequest, NotFound
|
||||
|
||||
from flaschengeist.plugins import AuthPlugin
|
||||
from flaschengeist.models.user import User
|
||||
|
@ -33,6 +33,14 @@ class AuthPlain(AuthPlugin):
|
|||
def delete_user(self, user):
|
||||
pass
|
||||
|
||||
def get_avatar(self, user):
|
||||
if not user.has_attribute("avatar"):
|
||||
raise NotFound
|
||||
return user.get_attribute("avatar")
|
||||
|
||||
def set_avatar(self, user, avatar):
|
||||
user.set_attribute("avatar", avatar)
|
||||
|
||||
@staticmethod
|
||||
def _hash_password(password):
|
||||
salt = hashlib.sha256(os.urandom(60)).hexdigest().encode("ascii")
|
||||
|
|
Loading…
Reference in New Issue