src/pyams_security/views/login.py
changeset 106 7e9dc748c6be
parent 102 44393819638c
child 116 89df87450c0c
equal deleted inserted replaced
105:c7e48faf88d1 106:7e9dc748c6be
   110         super(LoginForm, self).updateActions()
   110         super(LoginForm, self).updateActions()
   111         if 'login' in self.actions:
   111         if 'login' in self.actions:
   112             self.actions['login'].addClass('btn-primary')
   112             self.actions['login'].addClass('btn-primary')
   113 
   113 
   114     def createAndAdd(self, data):
   114     def createAndAdd(self, data):
       
   115         data = data.get(self, data)
   115         principal_id = data.get('principal_id')
   116         principal_id = data.get('principal_id')
   116         if principal_id is not None:
   117         if principal_id is not None:
   117             headers = remember(self.request, principal_id)
   118             headers = remember(self.request, principal_id)
   118             response = self.request.response
   119             response = self.request.response
   119             response.headerlist.extend(headers)
   120             response.headerlist.extend(headers)
   220         super(LoginDialogForm, self).updateActions()
   221         super(LoginDialogForm, self).updateActions()
   221         if 'login' in self.actions:
   222         if 'login' in self.actions:
   222             self.actions['login'].addClass('btn-primary')
   223             self.actions['login'].addClass('btn-primary')
   223 
   224 
   224     def createAndAdd(self, data):
   225     def createAndAdd(self, data):
       
   226         data = data.get(self, data)
   225         credentials = Credentials('form', id=data['login'], **data)
   227         credentials = Credentials('form', id=data['login'], **data)
   226         manager = query_utility(ISecurityManager)
   228         manager = query_utility(ISecurityManager)
   227         if manager is not None:
   229         if manager is not None:
   228             principal_id = manager.authenticate(credentials, self.request)
   230             principal_id = manager.authenticate(credentials, self.request)
   229             if principal_id is not None:
   231             if principal_id is not None: