diff --git a/apps/session/sparcsssov2.py b/apps/session/sparcsssov2.py index bdad749ed..0c812a754 100644 --- a/apps/session/sparcsssov2.py +++ b/apps/session/sparcsssov2.py @@ -77,7 +77,7 @@ def _post_data(self, url, data): except Exception: raise RuntimeError('INVALID_OBJECT') - def get_login_params(self): + def get_login_params(self, preferred_url): """ Get login parameters for SPARCS SSO login :returns: [url, state] where url is a url to redirect user, @@ -87,6 +87,7 @@ def get_login_params(self): params = { 'client_id': self.client_id, 'state': state, + 'preferred_url': preferred_url, } url = '?'.join([self.URLS['token_require'], urlencode(params)]) return [url, state] diff --git a/apps/session/views.py b/apps/session/views.py index a65b51982..a7c1aff44 100644 --- a/apps/session/views.py +++ b/apps/session/views.py @@ -75,7 +75,9 @@ def user_login(request): social_login = request.GET.get("social_login", None) - login_url, state = sso_client.get_login_params() + http_host = request.META["HTTP_HOST"] + login_url, state = sso_client.get_login_params("https://"+http_host+"/session/login/callback/") + if social_login == '0': login_url += '&social_enabled=0&show_disabled_button=0' request.session["sso_state"] = state diff --git a/docker/Dockerfile.back b/docker/Dockerfile.back index 0548b4d83..135f1a85c 100644 --- a/docker/Dockerfile.back +++ b/docker/Dockerfile.back @@ -11,6 +11,8 @@ WORKDIR /var/www/otlplus ADD ./requirements.txt ./requirements.txt RUN pip install -r requirements.txt +RUN pip install gevent + ADD . . EXPOSE 8000 @@ -20,4 +22,4 @@ ADD ./volumes/key.pem /root/key.pem ADD ./volumes/wheel-2021.pem /root/wheel-2021.pem RUN chown -R root:root /root && chmod 400 /root/key.pem && chmod 400 /root/wheel-2021.pem && echo "StrictHostKeyChecking no" >> /etc/ssh_config -CMD ["gunicorn", "otlplus.wsgi", "--bind", "0.0.0.0:8000"] +CMD ["gunicorn", "otlplus.wsgi", "--bind", "0.0.0.0:8000", "--log-file", "-", "--workers", "6", "--threads", "12", "--worker-class", "gevent"]