Fixed uncaught exception in auth and wrong example config
This commit is contained in:
parent
3f9fdc773c
commit
e4f42006a7
|
@ -12,15 +12,6 @@ HOST =
|
|||
PASSWORD =
|
||||
DATABASE =
|
||||
|
||||
# [LDAP]
|
||||
# URL =
|
||||
# PORT =
|
||||
# BINDDN =
|
||||
# SECRET =
|
||||
# USE_SSL =
|
||||
## ADMIN_DN:
|
||||
## ADMIN_SECRET:
|
||||
|
||||
[MAIL]
|
||||
URL =
|
||||
PORT =
|
||||
|
@ -29,6 +20,15 @@ PASSWD =
|
|||
MAIL =
|
||||
CRYPT = SSL/STARTLS
|
||||
|
||||
#[auth_ldap]
|
||||
# URL =
|
||||
# PORT =
|
||||
# BINDDN =
|
||||
# SECRET =
|
||||
# USE_SSL =
|
||||
## ADMIN_DN:
|
||||
## ADMIN_SECRET:
|
||||
|
||||
############################
|
||||
# Configuration of plugins #
|
||||
############################
|
||||
|
|
|
@ -42,8 +42,11 @@ def _create_token():
|
|||
"""
|
||||
logger.debug("Start log in.")
|
||||
data = request.get_json()
|
||||
userid = data['userid']
|
||||
password = data['password']
|
||||
try:
|
||||
userid = data['userid']
|
||||
password = data['password']
|
||||
except KeyError:
|
||||
raise BadRequest("Missing parameter(s)")
|
||||
|
||||
logger.debug("search user {{ {} }} in database".format(userid))
|
||||
user = userController.login_user(userid, password)
|
||||
|
|
|
@ -62,7 +62,7 @@ class User(db.Model):
|
|||
self.display_name = data['display_name']
|
||||
|
||||
def get_permissions(self):
|
||||
return [permission.name for role in self.roles for permission in role.permissions]
|
||||
return ["user"] + [permission.name for role in self.roles for permission in role.permissions]
|
||||
|
||||
def has_permissions(self, permissions):
|
||||
for role in self.roles:
|
||||
|
|
Loading…
Reference in New Issue