comses / miracle

Repeatable data analysis workflows for computational models
1 stars 3 forks source link

Third Party Authentication #4

Closed cpritcha closed 9 years ago

cpritcha commented 9 years ago

These changes allow the user to authenticate using Facebook, GitHub, Google and Twitter. However, I cannot figure out how to redirect to "home" after the user logs out. Right now, it goes to http://www.miracle.com:8001/logout/ (if localhost is set to www.miracle.com in your /etc/hosts file) which is part of Django Administration. When I try to add a view like (using http://stackoverflow.com/questions/21995917/python-social-auth-django-template-example)

def logout(request):
    logger.debug(msg='logged out')
    auth_logout(request)
    return redirect('/')

and reference the view in core/urls.py at r'^logout/$' the main template does not seem to use it. If I use a different route though like r'^logout5/$' and manually change the url in the browser to http://www.miracle.com:8001/logout5/ it works as I expect it to, logging out and redirecting to home. The logout url does was originally using a route in url(r'', include('django.contrib.auth.urls')) so I removed that but I still could not figure out how to get the base template to use my logout route.

If it would make it any easier to compare my vagrant machine is at https://github.com/cpritcha/miracle_build

landscape-bot commented 9 years ago

Code Health Code quality remained the same when pulling 4a7f143 on cpritcha:develop into 7f26d99 on comses:master.

cpritcha commented 9 years ago

From taking a look at https://github.com/django/django/blob/master/django/contrib/auth/views.py it looks template in `miracle/core/templates/registration/login.html' customizes the login templates for the login route. Is that right?

I tried creating a logged_out.html template under registrations to see if I could change the page from Django Admin to be similar to the rest of the site but that did not work. Am I on the right track?

For now, I'll work on getting other authentication services working.

landscape-bot commented 9 years ago

Code Health Code quality remained the same when pulling 1caad5e on cpritcha:develop into 7f26d99 on comses:master.

alee commented 9 years ago

Great, thanks! I'll fix up the redirects and probably make the URLs explicit.