diff --git a/app/__init__.py b/app/__init__.py index 7f0b4a2..fd5997a 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -62,7 +62,9 @@ def create_app(): Gravatar(app) @app.context_processor - def s3_cdn_path(): - return dict(s3_cdn=get_s3_cdn_prefix()) + def populate_context_variable(): + return dict(s3_cdn=get_s3_cdn_prefix(), + auth0_client_id=app.config['AUTH0_CLIENT_ID'], + auth0_domain=app.config['AUTH0_DOMAIN']) return app diff --git a/app/auth/controllers.py b/app/auth/controllers.py index 71a10f0..3c11b0f 100644 --- a/app/auth/controllers.py +++ b/app/auth/controllers.py @@ -52,9 +52,7 @@ def callback_handling(): return render_template("dashboard.html", user=user, title='Dashboard', - encoded_token=jwt_helper.encode(), - zappa_env=get_zappa_prefix(), - s3_cdn=get_s3_cdn_prefix()), 200 + encoded_token=jwt_helper.encode()), 200 except Exception as e: app.logger.error(e) return handle_error('GENERIC_ERROR', e.message, 500) diff --git a/app/site/controllers.py b/app/site/controllers.py index fdaa8d6..b42697b 100644 --- a/app/site/controllers.py +++ b/app/site/controllers.py @@ -41,9 +41,7 @@ def index(): return render_template("dashboard.html", user=user, title='Dashboard'), 200 return redirect(request.headers['Host'] + '/logout') - return render_template("index.html", title='Home', - auth0_client_id=app.config['AUTH0_CLIENT_ID'], - auth0_domain=app.config['AUTH0_DOMAIN']), 200 + return render_template("index.html", title='Home'), 200 except Exception: return redirect(url_for('.logout')) @@ -59,9 +57,7 @@ def logout(): 302: description: Load the Home Page """ - return render_template("logout.html", title='Home', - auth0_client_id=app.config['AUTH0_CLIENT_ID'], - auth0_domain=app.config['AUTH0_DOMAIN']), 200 + return render_template("logout.html", title='Home'), 200 @site_blueprint.route("//", methods=["GET"]) diff --git a/tests/site/test_controller.py b/tests/site/test_controller.py index b8dadb2..68fed98 100644 --- a/tests/site/test_controller.py +++ b/tests/site/test_controller.py @@ -337,6 +337,10 @@ def create_app(self): return create_app() def test_should_have_s3_cdn_value(self): - response = self.client.get('/') - print(response) + self.client.get('/') self.assert_context("s3_cdn", get_s3_cdn_prefix()) + + def test_should_have_auth0_client_id(self): + self.client.get('/') + self.assert_context("auth0_client_id", + self.app.config['AUTH0_CLIENT_ID'])