Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][FIX] auth_signup_verify_email: ensure right values are taken #768

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
Loading