Skip to content

Commit

Permalink
Merge pull request #17 from catalyst/fix-access-re
Browse files Browse the repository at this point in the history
webapp/access: fix envvar check
  • Loading branch information
stronk7 authored Jan 15, 2020
2 parents 2165e5c + 1c5316a commit c0860c7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions moodlemlbackend/webapp/access.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,14 @@ def access_wrapper(*args, **kwargs):
raise Exception(
envvarname + ' environment var is not set in the server.')

if re.match(os.environ[envvarname], '[^A-Za-z0-9_\-,$]'):
if re.search(os.environ[envvarname], '[^A-Za-z0-9_\-,:$]'):
raise Exception(
'The value of ' + envvarname + ' environment var does not ' +
' adhere to [^A-Za-z0-9_\-,$]')
'The value of ' + envvarname + ' environment should be '
'a list of colon separated user/password values.\n'
'Usernames and passwords can contain letters, numbers, '
'and the symbols "$_-".\n'
'Like this:\n'
' "user1:password1,user2:password2,user_3:pa$$word3"')

users = os.environ[envvarname].split(',')

Expand Down

0 comments on commit c0860c7

Please sign in to comment.