mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-25 01:12:16 +00:00
Fixed penguins of death due to infinite loop of SSO login redirects
This commit is contained in:
@@ -73,8 +73,11 @@ class DiscourseAuth(BaseAuth):
|
|||||||
def auth_complete(self, *args, **kwargs):
|
def auth_complete(self, *args, **kwargs):
|
||||||
"""Completes login process, must return user instance."""
|
"""Completes login process, must return user instance."""
|
||||||
|
|
||||||
if not self.sso.validate(self.data['sso'], self.data['sig']):
|
try:
|
||||||
raise Exception("Someone wants to hack us!")
|
if not self.sso.validate(self.data['sso'], self.data['sig']):
|
||||||
|
raise Exception("Someone wants to hack us!")
|
||||||
|
except KeyError:
|
||||||
|
raise Exception("SSO Error, please try again")
|
||||||
|
|
||||||
nonce = self.sso.get_nonce(self.data['sso'])
|
nonce = self.sso.get_nonce(self.data['sso'])
|
||||||
nonce_obj = self.get_nonce(nonce)
|
nonce_obj = self.get_nonce(nonce)
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class DiscourseSSO:
|
|||||||
payload.encode(),
|
payload.encode(),
|
||||||
sha256
|
sha256
|
||||||
).hexdigest()
|
).hexdigest()
|
||||||
print(type(computed_sig), type(sig))
|
|
||||||
return hmac.compare_digest(unicode(computed_sig), sig)
|
return hmac.compare_digest(unicode(computed_sig), sig)
|
||||||
|
|
||||||
def get_nonce(self, payload):
|
def get_nonce(self, payload):
|
||||||
|
|||||||
@@ -10,6 +10,8 @@
|
|||||||
|
|
||||||
|
|
||||||
<div class="panel-group">
|
<div class="panel-group">
|
||||||
|
{% url "social:complete" "discourse" as completeUrl %}
|
||||||
|
{% if not request.GET.next == completeUrl %}
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<h4 class="panel-title">
|
<h4 class="panel-title">
|
||||||
@@ -28,6 +30,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<h4 class="panel-title">
|
<h4 class="panel-title">
|
||||||
|
|||||||
Reference in New Issue
Block a user