Skip to content

Commit

Permalink
Use the standard debug flag.
Browse files Browse the repository at this point in the history
  • Loading branch information
keosak committed Jan 11, 2017
1 parent c2d8d45 commit 8a23c0c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
v1.1, 2017-01-11 -- Use standard debug flag.
v1.0, 2016-12-20 -- Initial release.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ only the authentication subsystem is supported.

The extension works in two modes: development and production.
In development, there is no communication with the Firebase
system, accounts sign-in with a simple email form.
system, accounts sign-in with a simple email form. The mode
depends on the `Flask.debug` variable.

## Configuration

- `FIREBASE_DEVELOPMENT`: `TRUE` or `FALSE` (default)
- `FIREBASE_API_KEY`: The API key.
- `FIREBASE_PROJECT_ID`: The project identifier, eg. `foobar`.
- `FIREBASE_AUTH_SIGN_IN_OPTIONS`: Comma-separated list of enabled providers.
Expand Down
12 changes: 6 additions & 6 deletions flask_firebase/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ class FirebaseAuth:
}

def __init__(self, app=None):
self.debug = None
self.api_key = None
self.project_id = None
self.provider_ids = None
self.server_name = None
self.development = None
self.production_load_callback = None
self.development_load_callback = None
self.unload_callback = None
Expand All @@ -60,8 +60,8 @@ def __init__(self, app=None):

def init_app(self, app):
app.extensions['firebase_auth'] = self
self.development = app.config.get('FIREBASE_DEVELOPMENT', False)
if self.development:
self.debug = app.debug
if self.debug:
return
self.api_key = app.config['FIREBASE_API_KEY']
self.project_id = app.config['FIREBASE_PROJECT_ID']
Expand All @@ -87,7 +87,7 @@ def unloader(self, callback):

def url_for(self, endpoint, **values):
full_endpoint = 'firebase_auth.{}'.format(endpoint)
if self.development:
if self.debug:
return url_for(full_endpoint, **values)
else:
return url_for(
Expand All @@ -98,7 +98,7 @@ def url_for(self, endpoint, **values):

def widget(self):
next_ = self.verify_redirection()
if self.development:
if self.debug:
if request.method == 'POST':
self.development_load_callback(request.form['email'])
return redirect(next_)
Expand All @@ -110,7 +110,7 @@ def widget(self):
firebase_auth=self)

def sign_in(self):
assert not self.development
assert not self.debug
header = jwt.get_unverified_header(request.data)
with self.lock:
self.refresh_keys()
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='Flask-Firebase',
version='1.0',
version='1.1',
description='Google Firebase integration for Flask',
packages=['flask_firebase'],
include_package_data=True,
Expand Down

0 comments on commit 8a23c0c

Please sign in to comment.