You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
794 B

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2014 ACSONE SA/NV (<http://acsone.eu>)
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  4. from openerp import api, fields, models
  5. import openerp.exceptions
  6. from openerp.addons.auth_from_http_remote_user import utils
  7. class ResUsers(models.Model):
  8. _inherit = 'res.users'
  9. sso_key = fields.Char(
  10. 'SSO Key', size=utils.KEY_LENGTH, readonly=True, copy=False)
  11. @api.model
  12. def check_credentials(self, password):
  13. try:
  14. return super(ResUsers, self).check_credentials(password)
  15. except openerp.exceptions.AccessDenied:
  16. res = self.sudo().search([('id', '=', self.env.uid),
  17. ('sso_key', '=', password)])
  18. if not res:
  19. raise