Skip to content

Commit

Permalink
feat: apply remote server changes
Browse files Browse the repository at this point in the history
  • Loading branch information
UrWrstNightmare committed Aug 27, 2023
1 parent 59d18c0 commit 0855370
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion apps/session/sparcsssov2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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]
Expand Down
4 changes: 3 additions & 1 deletion apps/session/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion docker/Dockerfile.back
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"]

0 comments on commit 0855370

Please sign in to comment.