Skip to content

Commit 50f1373

Browse files
committed
Redirect to main site or do nothing if auth fails
1 parent 5364224 commit 50f1373

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

docker-compose.yml

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ services:
1818
- cache:/data/cache:rw
1919
- static:/facerec/project/static:rw
2020
- ./requirements.txt:/facerec/requirements.txt
21+
- /home/lebowski/Downloads/:/data/s3:rw
2122
celery:
2223
extends: init
2324
command: facerec-ctl celery
@@ -28,6 +29,7 @@ services:
2829
- AUTH0_DOMAIN=
2930
- AUTH0_KEY=
3031
- AUTH0_SECRET=
32+
- AUTH0_REDIRECT_URL=''
3133
command: facerec-ctl uwsgi
3234
expose:
3335
- 8000

project/aat/auth0backend.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
import os
12
import requests
23
import logging
34
import json
45

56
from django.shortcuts import redirect
7+
68
from social_core.utils import handle_http_errors
79
from social_core.exceptions import AuthFailed
810
from social_core.backends.oauth import BaseOAuth2
@@ -41,7 +43,10 @@ def auth_complete(self, *args, **kwargs):
4143
data = {"error":"denied"}
4244
raise AuthFailed(self, data)
4345
except AuthFailed:
44-
return redirect('http://producer-toolkit.eu/#/login')
46+
if (os.getenv('AUTH0_REDIRECT_URL'))
47+
return redirect('http://producer-toolkit.eu/#/login')
48+
else:
49+
return
4550
return self.do_auth(response['access_token'], response=response,
4651
*args, **kwargs)
4752

0 commit comments

Comments
 (0)