Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I think what you need to do is to setup a post login handler action when you setup the middleware. In that action you can then check params, set a session var, etc. I had to hook into here in order to create a message to the user that their login had failed. I check for a 'login_failed' param on the login form. </p> <pre><code> def post_login(self): """ Handle logic post a user's login I want to create a login_handler that's redirected to after login. This would check - if user was logged in, if not then send back to login - if user is admin, go to job list - adjust the max age on the existing cookie to XX remember me timeframe """ if auth.check(not_anonymous()): log.debug('checked auth') else: # login failed, redirect back to login log.debug('failed auth') redirect_to(controller="root", action="login", login_failed=True) # expire this cookie into the future ck = request.cookies['authtkt'] response.set_cookie('authtkt', ck, max_age=60*60*24*7, path='/' ) redirect_to(controller="job", action="list") </code></pre> <p>In response for more details, too big to add as another comment:</p> <p>So I've got a few things you can look at. First, this is my docs I'm writing as a repoze 'summary' to help explain to other devs how this stuff works/terminology used:</p> <p><a href="http://72.14.191.199/docs/morpylons/auth_overview.html" rel="nofollow noreferrer">http://72.14.191.199/docs/morpylons/auth_overview.html</a></p> <p>I started out using the repoze sql quickstart plugin: <a href="http://code.gustavonarea.net/repoze.what-quickstart/" rel="nofollow noreferrer">http://code.gustavonarea.net/repoze.what-quickstart/</a></p> <p>I then ripped out their setup_sql_auth and modified it for our own needs since we do both SQL and LDAP auth in our apps. Go make sure to look at the plugin source for setup_sql_auth and go through it until you really understand what it's doing. </p> <p>and since you asked on middleware config...</p> <pre><code> app = setup_morpace_auth(app, User, Group, Permission, meta.Session, post_login_url='/root/post_login', post_logout_url='/login', log_level='debug', log_file='stdout' ) </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload