Skip to content

Commit

Permalink
raw support for github authentication
Browse files Browse the repository at this point in the history
  • Loading branch information
ihptru committed Feb 10, 2014
1 parent 2ddc41b commit e7292f7
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 3 deletions.
13 changes: 12 additions & 1 deletion INSTALL.md
Expand Up @@ -7,11 +7,15 @@ That's just our preference, so if you deploy it, you can choose any Database you
python (version 2)
python-psycopg2 (postgresql module)
python-magic
python-openid
python-requests
python-requests-oauthlib
Django python Web Framework version 1.6
mono 2.10 +
OpenRA.Utility and OpenRA.Lint
django-registration module (easy_install -Z django-registration)
sendmail
django-allauth (pip install django-allauth)
sendmail (or any other mail server)
curl
```

Expand All @@ -20,6 +24,7 @@ curl
* Create new user for web site in your unix system
* Django web server user must have .openra directory in it's home and have owner rights to it (for OpenRA.Utility)
* Directory with compiled OpenRA tools must have write permissions for Django web server user
* Make sure Django web server user can write to '/tmp/'
* This repository root is actually a Django Site with additional Apps

### Edit Django settings.py (systemTool/settings.py)
Expand Down Expand Up @@ -53,3 +58,9 @@ python manage.py syncdb

### Setup WebServer etc.

### Post-Installation
## Configure allauth
* Create an application at github (callback url: http://yoursitedomain.com/accounts/github/login/callback/)
* Go to your site admin page --> "Sites" (django.contrib.sites application) --> create a site with proper domain name
* Go to "Social Apps" --> Add a new social app (set a proper client id and secret, chose a proper site)
* Load http://yoursitedomain.com/accounts/github/login/ to authorize your new application at github
2 changes: 1 addition & 1 deletion openraData/urls.py
Expand Up @@ -35,7 +35,7 @@
url(r'^assets/?$', views.assets, name='assets'),

url(r'^replays/?$', views.replays, name='replays'),

url(r'^login/?$', views.loginView, name='loginView'),
url(r'^login/register/?$', RegistrationView.as_view(form_class=RegistrationFormUniqueEmail),
name='registration_register'),
Expand Down
22 changes: 22 additions & 0 deletions systemTool/settings.py
Expand Up @@ -26,6 +26,23 @@

ALLOWED_HOSTS = []

SITE_ID = 1

TEMPLATE_CONTEXT_PROCESSORS = (
"django.contrib.auth.context_processors.auth",
# Required by allauth template tags
"django.core.context_processors.request",
# allauth specific context processors
"allauth.account.context_processors.account",
"allauth.socialaccount.context_processors.socialaccount",
)

AUTHENTICATION_BACKENDS = (
# Needed to login by username in Django admin, regardless of `allauth`
"django.contrib.auth.backends.ModelBackend",
# `allauth` specific authentication methods, such as login by e-mail
"allauth.account.auth_backends.AuthenticationBackend",
)

# Application definition

Expand All @@ -40,6 +57,11 @@
'registration',
'openraData',
'djangoratings',
'django.contrib.sites',
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.socialaccount.providers.github',
)

MIDDLEWARE_CLASSES = (
Expand Down
3 changes: 2 additions & 1 deletion systemTool/urls.py
@@ -1,9 +1,10 @@
from django.conf.urls import patterns, include, url

from django.contrib import admin

admin.autodiscover()

urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^accounts/', include('allauth.urls')),
url(r'^', include('openraData.urls')),
)

0 comments on commit e7292f7

Please sign in to comment.