Skip to content

Commit

Permalink
[16.0][FIX] auth_signup_verify_email: ensure right values are taken
Browse files Browse the repository at this point in the history
This commit enables the extension of the values from other modules
Fix #767
  • Loading branch information
gbrito committed Feb 28, 2025
1 parent d7ebb65 commit 0840e79
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
1 change: 1 addition & 0 deletions auth_signup_verify_email/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import controllers
from . import models
6 changes: 1 addition & 5 deletions auth_signup_verify_email/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,7 @@ def passwordless_signup(self):
values["email"] = values.get("login")

# remove values that could raise "Invalid field '*' on model 'res.users'"
values.pop("redirect", "")
values.pop("token", "")

# Remove password
values["password"] = ""
values = request.env["res.users"]._auth_signup_prepare_values(values)
sudo_users = request.env["res.users"].with_context(create_user=True).sudo()

try:
Expand Down
1 change: 1 addition & 0 deletions auth_signup_verify_email/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import res_users
20 changes: 20 additions & 0 deletions auth_signup_verify_email/models/res_users.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2025 - Bigorna
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import api, models


class ResUsers(models.Model):
_inherit = "res.users"

@api.model
def _auth_signup_required_fields(self):
return ["name", "login", "email"]

@api.model
def _auth_signup_prepare_values(self, values):
return {
field: values.get(field)
for field in self._auth_signup_required_fields()
if field in values
}

0 comments on commit 0840e79

Please sign in to comment.