enable oauth, set correct default oauth success endpoint
This commit is contained in:
parent
a0124baf1d
commit
4fede50136
|
@ -31,7 +31,7 @@ class Auth(object):
|
||||||
def login_forms():
|
def login_forms():
|
||||||
forms = []
|
forms = []
|
||||||
# TODO be dynamic
|
# TODO be dynamic
|
||||||
for t in ['local', 'ldap']:
|
for t in ['local', 'ldap', 'oauth']:
|
||||||
forms.append(Auth.get_auth_user(t).login_form())
|
forms.append(Auth.get_auth_user(t).login_form())
|
||||||
return forms
|
return forms
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from flask import Blueprint, url_for, request, flash, redirect, session
|
from flask import Blueprint, url_for, request, flash, redirect, session, current_app
|
||||||
from .models import User
|
from .models import User
|
||||||
|
|
||||||
blueprint = Blueprint('auth.oauth', __name__)
|
blueprint = Blueprint('auth.oauth', __name__)
|
||||||
|
@ -16,7 +16,7 @@ def login(provider):
|
||||||
|
|
||||||
@blueprint.route('/login/oauth/<provider>/callback')
|
@blueprint.route('/login/oauth/<provider>/callback')
|
||||||
def callback(provider):
|
def callback(provider):
|
||||||
next_url = request.args.get('next') or url_for('index')
|
next_url = request.args.get('next') or current_app.config['ROOT_ENDPOINT']
|
||||||
try:
|
try:
|
||||||
resp = User.get_app(provider).authorized_response()
|
resp = User.get_app(provider).authorized_response()
|
||||||
if resp is None:
|
if resp is None:
|
||||||
|
|
Loading…
Reference in a new issue