web/views/sessions.py
branchstable
changeset 9542 79b9bf88be28
parent 9492 c7fc56eecd1a
child 9543 39f981482e34
equal deleted inserted replaced
9540:43b4895a150f 9542:79b9bf88be28
    93         # XXX: this should be in a post login hook in the repository, but there
    93         # XXX: this should be in a post login hook in the repository, but there
    94         #      we can't differentiate actual login of automatic session
    94         #      we can't differentiate actual login of automatic session
    95         #      reopening. Is it actually a problem?
    95         #      reopening. Is it actually a problem?
    96         if 'last_login_time' in req.vreg.schema:
    96         if 'last_login_time' in req.vreg.schema:
    97             self._update_last_login_time(req)
    97             self._update_last_login_time(req)
    98         req.set_message(req._('welcome %s !') % req.user.login)
    98         req.set_message(req._('welcome %s!') % req.user.login)
    99 
    99 
   100     def _update_last_login_time(self, req):
   100     def _update_last_login_time(self, req):
   101         # XXX should properly detect missing permission / non writeable source
   101         # XXX should properly detect missing permission / non writeable source
   102         # and avoid "except (RepositoryError, Unauthorized)" below
   102         # and avoid "except (RepositoryError, Unauthorized)" below
   103         if req.user.cw_metainformation()['source']['type'] == 'ldapuser':
       
   104             return
       
   105         try:
   103         try:
   106             req.execute('SET X last_login_time NOW WHERE X eid %(x)s',
   104             req.execute('SET X last_login_time NOW WHERE X eid %(x)s',
   107                         {'x' : req.user.eid})
   105                         {'x' : req.user.eid})
   108             req.cnx.commit()
   106             req.cnx.commit()
   109         except (RepositoryError, Unauthorized):
   107         except (RepositoryError, Unauthorized):