Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions neuropy/neuropy/client_secret.json

This file was deleted.

14 changes: 6 additions & 8 deletions neuropy/neuropy/oauth.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
"""Code for return auth."""
from oauth2client.contrib.django_util.storage import DjangoORMStorage
from django.contrib.auth.decorators import login_required
from oauth2client.client import flow_from_clientsecrets
from oauth2client.client import OAuth2WebServerFlow
from userprofile.models import CredentialsModel
from django.http import HttpResponseBadRequest
from django.http import HttpResponseRedirect
from oauth2client.contrib import xsrfutil
from neuropy import settings
import os


CLIENT_SECRETS = os.path.join(os.path.dirname(__file__), 'client_secret.json')

FLOW = flow_from_clientsecrets(
CLIENT_SECRETS,
FLOW = OAuth2WebServerFlow(
client_id=settings.GOOGLE_OAUTH2_CLIENT_ID,
client_secret=settings.GOOGLE_OAUTH2_CLIENT_SECRET,
scope='https://www.googleapis.com/auth/calendar',
redirect_uri='http://localhost:8000/oauth2callback'
redirect_uri='http://localhost:8000/oauth2callback',
prompt='consent'
)


Expand Down
13 changes: 6 additions & 7 deletions neuropy/todo/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@
from oauth2client.contrib.django_util.storage import DjangoORMStorage
from oauth2client.contrib import xsrfutil
import httplib2
import os
from neuropy import settings
from oauth2client.client import flow_from_clientsecrets
from oauth2client.client import OAuth2WebServerFlow


class AddTodo(LoginRequiredMixin, CreateView):
Expand Down Expand Up @@ -122,12 +121,12 @@ def calender_update(http, event):
event = service.events().update(calendarId='prmary', body=event).execute()
return event

CLIENT_SECRETS = os.path.join(os.path.dirname(__file__), '..', 'neuropy', 'client_secret.json')

FLOW = flow_from_clientsecrets(
CLIENT_SECRETS,
FLOW = OAuth2WebServerFlow(
client_id=settings.GOOGLE_OAUTH2_CLIENT_ID,
client_secret=settings.GOOGLE_OAUTH2_CLIENT_SECRET,
scope='https://www.googleapis.com/auth/calendar',
redirect_uri='http://localhost:8000/oauth2callback'
redirect_uri='http://localhost:8000/oauth2callback',
prompt='consent'
)


Expand Down
15 changes: 7 additions & 8 deletions neuropy/userprofile/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Views for profile."""

import os
import httplib2
from django.contrib.auth.mixins import LoginRequiredMixin
from django.http import HttpResponseRedirect
Expand All @@ -13,17 +12,17 @@
from oauth2client.contrib.django_util.storage import DjangoORMStorage
from oauth2client.contrib import xsrfutil
from neuropy import settings
from oauth2client.client import flow_from_clientsecrets
from oauth2client.client import OAuth2WebServerFlow


CLIENT_SECRETS = os.path.join(os.path.dirname(__file__), '..', 'neuropy', 'client_secret.json')

FLOW = flow_from_clientsecrets(
CLIENT_SECRETS,
FLOW = OAuth2WebServerFlow(
client_id=settings.GOOGLE_OAUTH2_CLIENT_ID,
client_secret=settings.GOOGLE_OAUTH2_CLIENT_SECRET,
scope='https://www.googleapis.com/auth/calendar',
redirect_uri='http://localhost:8000/oauth2callback'
redirect_uri='http://localhost:8000/oauth2callback',
prompt='consent'
)


class ProfileView(LoginRequiredMixin, DetailView):
"""View for profile."""

Expand Down