Skip to content
This repository has been archived by the owner on Oct 27, 2020. It is now read-only.

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
andriyor committed Apr 4, 2017
1 parent 972b186 commit 61c740b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
server.crt
server.key
test.db
.idea/
21 changes: 12 additions & 9 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
import json
import datetime

from flask import Flask, url_for, redirect, \
render_template, session, request
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.login import LoginManager, login_required, login_user, \
logout_user, current_user, UserMixin
from flask import Flask, url_for, redirect, render_template, session, request
from flask_sqlalchemy import SQLAlchemy
from flask_login import LoginManager, login_required, login_user, logout_user, current_user, UserMixin
from requests_oauthlib import OAuth2Session
from requests.exceptions import HTTPError

Expand All @@ -17,10 +15,9 @@

class Auth:
"""Google Project Credentials"""
CLIENT_ID = ('688061596571-3c13n0uho6qe34hjqj2apincmqk86ddj'
'.apps.googleusercontent.com')
CLIENT_SECRET = 'JXf7Ic_jfCam1S7lBJalDyPZ'
REDIRECT_URI = 'https://localhost:5000/gCallback'
CLIENT_ID = os.environ.get('CLIENT_ID')
CLIENT_SECRET = os.environ.get('CLIENT_SECRET')
REDIRECT_URI = 'https://127.0.0.1:5000/gCallback'
AUTH_URI = 'https://accounts.google.com/o/oauth2/auth'
TOKEN_URI = 'https://accounts.google.com/o/oauth2/token'
USER_INFO = 'https://www.googleapis.com/userinfo/v2/me'
Expand All @@ -31,6 +28,7 @@ class Config:
"""Base config"""
APP_NAME = "Test Google Login"
SECRET_KEY = os.environ.get("SECRET_KEY") or "somethingsecret"
SQLALCHEMY_TRACK_MODIFICATIONS = True


class DevConfig(Config):
Expand Down Expand Up @@ -154,3 +152,8 @@ def callback():
def logout():
logout_user()
return redirect(url_for('index'))


if __name__ == "__main__":
db.create_all()
app.run(ssl_context=('server.crt', 'server.key'))
2 changes: 1 addition & 1 deletion index.html → templates/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{%- if current_user.is_authenticated() -%}
{%- if current_user.is_authenticated -%}
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<form class="navbar-form navbar-left" role="search" action="/search">
<div class="form-group">
Expand Down
File renamed without changes.

0 comments on commit 61c740b

Please sign in to comment.