projects
/
cascardo
/
ipsilon.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add a method to Installer classes to validate argument input
[cascardo/ipsilon.git]
/
ipsilon
/
login
/
common.py
diff --git
a/ipsilon/login/common.py
b/ipsilon/login/common.py
index
4b715f3
..
9beb741
100644
(file)
--- a/
ipsilon/login/common.py
+++ b/
ipsilon/login/common.py
@@
-37,9
+37,12
@@
class LoginManagerBase(PluginConfig, PluginObject):
self.path = '/'
self.info = None
self.path = '/'
self.info = None
- def redirect_to_path(self, path):
+ def redirect_to_path(self, path
, trans=None
):
base = cherrypy.config.get('base.mount', "")
base = cherrypy.config.get('base.mount', "")
- raise cherrypy.HTTPRedirect('%s/login/%s' % (base, path))
+ url = '%s/login/%s' % (base, path)
+ if trans:
+ url += '?%s' % trans.get_GET_arg()
+ raise cherrypy.HTTPRedirect(url)
def auth_successful(self, trans, username, auth_type=None, userdata=None):
session = UserSession()
def auth_successful(self, trans, username, auth_type=None, userdata=None):
session = UserSession()
@@
-100,7
+103,7
@@
class LoginManagerBase(PluginConfig, PluginObject):
# try with next module
next_login = self.next_login()
if next_login:
# try with next module
next_login = self.next_login()
if next_login:
- return self.redirect_to_path(next_login.path)
+ return self.redirect_to_path(next_login.path
, trans
)
# return to the caller if any
session = UserSession()
# return to the caller if any
session = UserSession()
@@
-119,6
+122,9
@@
class LoginManagerBase(PluginConfig, PluginObject):
raise cherrypy.HTTPRedirect(transdata['login_return'])
raise cherrypy.HTTPRedirect(transdata['login_return'])
+ def set_auth_error(self):
+ cherrypy.response.status = 401
+
def get_tree(self, site):
raise NotImplementedError
def get_tree(self, site):
raise NotImplementedError
@@
-304,6
+310,9
@@
class LoginManagerInstaller(object):
def install_args(self, group):
raise NotImplementedError
def install_args(self, group):
raise NotImplementedError
+ def validate_args(self, args):
+ return
+
def configure(self, opts):
raise NotImplementedError
def configure(self, opts):
raise NotImplementedError