|
a/Allura/allura/controllers/auth.py |
|
b/Allura/allura/controllers/auth.py |
|
... |
|
... |
46 |
|
46 |
|
47 |
def __init__(self):
|
47 |
def __init__(self):
|
48 |
self.prefs = PreferencesController()
|
48 |
self.prefs = PreferencesController()
|
49 |
self.oauth = OAuth()
|
49 |
self.oauth = OAuth()
|
50 |
|
50 |
|
51 |
@expose('jinja:login.html')
|
51 |
@expose('jinja:allura:templates/login.html')
|
52 |
@with_trailing_slash
|
52 |
@with_trailing_slash
|
53 |
def index(self, *args, **kwargs):
|
53 |
def index(self, *args, **kwargs):
|
54 |
orig_request = request.environ.get('pylons.original_request', None)
|
54 |
orig_request = request.environ.get('pylons.original_request', None)
|
55 |
if 'return_to' in kwargs:
|
55 |
if 'return_to' in kwargs:
|
56 |
return_to = kwargs.pop('return_to')
|
56 |
return_to = kwargs.pop('return_to')
|
|
... |
|
... |
58 |
return_to = orig_request.url
|
58 |
return_to = orig_request.url
|
59 |
else:
|
59 |
else:
|
60 |
return_to = request.referer
|
60 |
return_to = request.referer
|
61 |
return dict(oid_providers=OID_PROVIDERS, return_to=return_to)
|
61 |
return dict(oid_providers=OID_PROVIDERS, return_to=return_to)
|
62 |
|
62 |
|
63 |
@expose('jinja:custom_login.html')
|
63 |
@expose('jinja:allura:templates/custom_login.html')
|
64 |
def login_verify_oid(self, provider, username, return_to=None):
|
64 |
def login_verify_oid(self, provider, username, return_to=None):
|
65 |
if provider:
|
65 |
if provider:
|
66 |
oid_url = string.Template(provider).safe_substitute(
|
66 |
oid_url = string.Template(provider).safe_substitute(
|
67 |
username=username)
|
67 |
username=username)
|
68 |
else:
|
68 |
else:
|
|
... |
|
... |
82 |
flash('Please choose a user name for SourceForge, %s.'
|
82 |
flash('Please choose a user name for SourceForge, %s.'
|
83 |
% c.user.get_pref('display_name'))
|
83 |
% c.user.get_pref('display_name'))
|
84 |
redirect('setup_openid_user')
|
84 |
redirect('setup_openid_user')
|
85 |
redirect(kw.pop('return_to', '/'))
|
85 |
redirect(kw.pop('return_to', '/'))
|
86 |
|
86 |
|
87 |
@expose('jinja:bare_openid.html')
|
87 |
@expose('jinja:allura:templates/bare_openid.html')
|
88 |
def bare_openid(self, url=None):
|
88 |
def bare_openid(self, url=None):
|
89 |
'''Called to notify the user that they must set up a 'real' (with
|
89 |
'''Called to notify the user that they must set up a 'real' (with
|
90 |
username) account when they have a pure openid account'''
|
90 |
username) account when they have a pure openid account'''
|
91 |
return dict(location=url)
|
91 |
return dict(location=url)
|
92 |
|
92 |
|
93 |
@expose('jinja:setup_openid_user.html')
|
93 |
@expose('jinja:allura:templates/setup_openid_user.html')
|
94 |
def setup_openid_user(self):
|
94 |
def setup_openid_user(self):
|
95 |
return dict()
|
95 |
return dict()
|
96 |
|
96 |
|
97 |
@expose('jinja:create_account.html')
|
97 |
@expose('jinja:allura:templates/create_account.html')
|
98 |
def create_account(self, **kw):
|
98 |
def create_account(self, **kw):
|
99 |
c.form = F.registration_form
|
99 |
c.form = F.registration_form
|
100 |
return dict()
|
100 |
return dict()
|
101 |
|
101 |
|
102 |
@expose()
|
102 |
@expose()
|
|
... |
|
... |
145 |
n = M.Neighborhood.query.get(name='Users')
|
145 |
n = M.Neighborhood.query.get(name='Users')
|
146 |
n.register_project('u/' + username)
|
146 |
n.register_project('u/' + username)
|
147 |
flash('Your username has been set to %s.' % username)
|
147 |
flash('Your username has been set to %s.' % username)
|
148 |
redirect('/')
|
148 |
redirect('/')
|
149 |
|
149 |
|
150 |
@expose('jinja:claim_openid.html')
|
150 |
@expose('jinja:allura:templates/claim_openid.html')
|
151 |
def claim_oid(self):
|
151 |
def claim_oid(self):
|
152 |
return dict(oid_providers=OID_PROVIDERS)
|
152 |
return dict(oid_providers=OID_PROVIDERS)
|
153 |
|
153 |
|
154 |
@expose('jinja:custom_login.html')
|
154 |
@expose('jinja:allura:templates/custom_login.html')
|
155 |
def claim_verify_oid(self, provider, username):
|
155 |
def claim_verify_oid(self, provider, username):
|
156 |
if provider:
|
156 |
if provider:
|
157 |
oid_url = string.Template(provider).safe_substitute(
|
157 |
oid_url = string.Template(provider).safe_substitute(
|
158 |
username=username)
|
158 |
username=username)
|
159 |
else:
|
159 |
else:
|
|
... |
|
... |
249 |
allow_create=has_artifact_access('create')(user=user))
|
249 |
allow_create=has_artifact_access('create')(user=user))
|
250 |
|
250 |
|
251 |
class PreferencesController(BaseController):
|
251 |
class PreferencesController(BaseController):
|
252 |
|
252 |
|
253 |
@with_trailing_slash
|
253 |
@with_trailing_slash
|
254 |
@expose('jinja:user_preferences.html')
|
254 |
@expose('jinja:allura:templates/user_preferences.html')
|
255 |
def index(self, **kw):
|
255 |
def index(self, **kw):
|
256 |
require_authenticated()
|
256 |
require_authenticated()
|
257 |
c.form = F.subscription_form
|
257 |
c.form = F.subscription_form
|
258 |
c.revoke_access = F.oauth_revocation_form
|
258 |
c.revoke_access = F.oauth_revocation_form
|
259 |
subscriptions = []
|
259 |
subscriptions = []
|
|
... |
|
... |
388 |
flash('Key uploaded')
|
388 |
flash('Key uploaded')
|
389 |
redirect('.')
|
389 |
redirect('.')
|
390 |
|
390 |
|
391 |
class OAuth(BaseController):
|
391 |
class OAuth(BaseController):
|
392 |
|
392 |
|
393 |
@expose('jinja:oauth_applications.html')
|
393 |
@expose('jinja:allura:templates/oauth_applications.html')
|
394 |
def index(self, **kw):
|
394 |
def index(self, **kw):
|
395 |
c.form = F.oauth_application_form
|
395 |
c.form = F.oauth_application_form
|
396 |
return dict(apps=M.OAuthConsumerToken.for_user(c.user))
|
396 |
return dict(apps=M.OAuthConsumerToken.for_user(c.user))
|
397 |
|
397 |
|
398 |
@expose()
|
398 |
@expose()
|