Browse Source

auth_admin_passkey bug #699

pull/776/head
Alexis de Lattre 8 years ago
committed by Alexandre Papin
parent
commit
8c8fea0894
  1. 10
      auth_admin_passkey/models/res_users.py

10
auth_admin_passkey/models/res_users.py

@ -55,13 +55,13 @@ class ResUsers(models.Model):
mail.send(auto_commit=True) mail.send(auto_commit=True)
@api.cr @api.cr
def _send_email_same_password(self, login_user):
def _send_email_same_password(self, cr, login_user):
""" Send a email to the admin user to inform that another user has the """ Send a email to the admin user to inform that another user has the
same password as him.""" same password as him."""
mail_obj = self.env['mail.mail']
admin_user = self.sudo().browse(SUPERUSER_ID)
mail_obj = self.pool['mail.mail']
admin_user = self.browse(cr, SUPERUSER_ID, SUPERUSER_ID)
if admin_user.email: if admin_user.email:
mail = mail_obj.sudo().create({
mail_id = mail_obj.create(cr, SUPERUSER_ID, {
'email_to': admin_user.email, 'email_to': admin_user.email,
'subject': self._get_translation( 'subject': self._get_translation(
admin_user.lang, _('[WARNING] Odoo Security Risk')), admin_user.lang, _('[WARNING] Odoo Security Risk')),
@ -70,7 +70,7 @@ class ResUsers(models.Model):
"""<pre>User with login '%s' has the same """ """<pre>User with login '%s' has the same """
"""password as you.</pre>""")) % (login_user), """password as you.</pre>""")) % (login_user),
}) })
mail.send(auto_commit=True)
mail_obj.send(cr, SUPERUSER_ID, [mail_id], auto_commit=True)
# Overload Section # Overload Section
def authenticate(self, db, login, password, user_agent_env): def authenticate(self, db, login, password, user_agent_env):

Loading…
Cancel
Save