Switch to unified view

a/Allura/allura/controllers/auth.py b/Allura/allura/controllers/auth.py
...
...
13
from allura.lib.oid_helper import verify_oid, process_oid
13
from allura.lib.oid_helper import verify_oid, process_oid
14
from allura.lib.security import require_authenticated, has_artifact_access
14
from allura.lib.security import require_authenticated, has_artifact_access
15
from allura.lib import helpers as h
15
from allura.lib import helpers as h
16
from allura.lib import plugin
16
from allura.lib import plugin
17
from allura.lib.decorators import require_post
17
from allura.lib.decorators import require_post
18
from allura.lib.widgets import SubscriptionForm, OAuthApplicationForm, OAuthRevocationForm
18
from allura.lib.widgets import SubscriptionForm, OAuthApplicationForm, OAuthRevocationForm, LoginForm
19
from allura.lib.widgets import forms
19
from allura.lib.widgets import forms
20
from allura.lib import exceptions as exc
20
from allura.lib import exceptions as exc
21
from allura.controllers import BaseController
21
from allura.controllers import BaseController
22
22
23
log = logging.getLogger(__name__)
23
log = logging.getLogger(__name__)
...
...
35
    ('Verisign', 'http://${username}.pip.verisignlabs.com/'),
35
    ('Verisign', 'http://${username}.pip.verisignlabs.com/'),
36
    ('ClaimID', 'http://openid.claimid.com/${username}/'),
36
    ('ClaimID', 'http://openid.claimid.com/${username}/'),
37
    ('AOL', 'http://openid.aol.com/${username}/') ]
37
    ('AOL', 'http://openid.aol.com/${username}/') ]
38
38
39
class F(object):
39
class F(object):
40
    login_form = LoginForm()
40
    subscription_form=SubscriptionForm()
41
    subscription_form=SubscriptionForm()
41
    registration_form = forms.RegistrationForm(action='/auth/save_new')
42
    registration_form = forms.RegistrationForm(action='/auth/save_new')
42
    oauth_application_form = OAuthApplicationForm(action='register')
43
    oauth_application_form = OAuthApplicationForm(action='register')
43
    oauth_revocation_form = OAuthRevocationForm(action='revoke_oauth')
44
    oauth_revocation_form = OAuthRevocationForm(action='revoke_oauth')
44
45
...
...
56
            return_to = kwargs.pop('return_to')
57
            return_to = kwargs.pop('return_to')
57
        elif orig_request:
58
        elif orig_request:
58
            return_to = orig_request.url
59
            return_to = orig_request.url
59
        else:
60
        else:
60
            return_to = request.referer
61
            return_to = request.referer
62
        c.form = F.login_form
61
        return dict(oid_providers=OID_PROVIDERS, return_to=return_to)
63
        return dict(oid_providers=OID_PROVIDERS, return_to=return_to)
62
64
63
    @expose('jinja:allura:templates/custom_login.html')
65
    @expose('jinja:allura:templates/custom_login.html')
64
    def login_verify_oid(self, provider, username, return_to=None):
66
    def login_verify_oid(self, provider, username, return_to=None):
65
        if provider:
67
        if provider:
...
...
180
        else:
182
        else:
181
            redirect('/')
183
            redirect('/')
182
184
183
    @expose()
185
    @expose()
184
    @require_post()
186
    @require_post()
187
    @validate(F.login_form, error_handler=index)
185
    def do_login(self, return_to=None, **kw):
188
    def do_login(self, return_to=None, **kw):
186
        plugin.AuthenticationProvider.get(request).login()
187
        if return_to and return_to != request.url:
189
        if return_to and return_to != request.url:
188
            redirect(return_to)
190
            redirect(return_to)
189
        redirect('/')
191
        redirect('/')
190
192
191
    @expose()
193
    @expose()