Skip to content
Snippets Groups Projects
Commit 4c89be6b authored by Rajmund Hruška's avatar Rajmund Hruška
Browse files

Fix: Use correct encoding for the name given by the environment variable. (Redmine issue: #7553)

parent 6c93fd19
No related branches found
No related tags found
No related merge requests found
...@@ -13,7 +13,7 @@ This pluggable module provides default authentication service based on server ...@@ -13,7 +13,7 @@ This pluggable module provides default authentication service based on server
environment. In this case the burden of performing actual authentication is environment. In this case the burden of performing actual authentication is
on the web server used for serving the web interface. The authentication module on the web server used for serving the web interface. The authentication module
then simply uses selected environment variables set up by the server after then simply uses selected environment variables set up by the server after
successfull authentication. successful authentication.
This module also provides interface for automated user account registration. The This module also provides interface for automated user account registration. The
registration form is pre-filled with data gathered again from server environment. registration form is pre-filled with data gathered again from server environment.
...@@ -183,14 +183,14 @@ class RegisterView(HTMLMixin, SQLAlchemyMixin, BaseRegisterView): ...@@ -183,14 +183,14 @@ class RegisterView(HTMLMixin, SQLAlchemyMixin, BaseRegisterView):
# Try to fetch name from server authentication headers (optional). # Try to fetch name from server authentication headers (optional).
while True: while True:
try: try:
item.fullname = flask.request.environ['cn'] item.fullname = flask.request.environ['cn'].encode("iso-8859-1").decode()
break break
except (KeyError, AttributeError): except (KeyError, AttributeError):
pass pass
try: try:
item.fullname = '{} {}'.format( item.fullname = '{} {}'.format(
flask.request.environ['givenName'], flask.request.environ['givenName'].encode("iso-8859-1").decode(),
flask.request.environ['sn'] flask.request.environ['sn'].encode("iso-8859-1").decode()
) )
break break
except (KeyError, AttributeError): except (KeyError, AttributeError):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment