Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Managament
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Producție
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

Restrict ecommerce website signup to certain email domain

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
developmentshop
2 Răspunsuri
1681 Vizualizări
Imagine profil
Admin matprotect

Hello,

I would like to only allow users from my own company to signup to my ecommerce website. They all have an email address ending with MyCompany domain name like this "XXXX@MyCompany.com" so I would like to restrict new signups based on the email address.

How to best implement this?

Any help would be much appreciated 🙏

1
Imagine profil
Abandonează
Josep Anton Belchi Riera

You can restrict the creation of new users in Odoo.



With this setting, only users with your invitation can create an account in Odoo.

Odiware Technologies

1. Override the Signup Controller

Modify Odoo’s auth_signup controller to check the email domain before allowing registration.

📌 Steps:

  1. Create a new module or update your existing custom module.
  2. Extend the AuthSignupHome controller to restrict email domains.

📌 Example Code (Python - Controller Override):

python

CopyEdit

from odoo import http from odoo.http import request from odoo.addons.auth_signup.controllers.main import AuthSignupHome ALLOWED_DOMAIN = "mycompany.com" class CustomAuthSignup(AuthSignupHome): def do_signup(self, qcontext): email = qcontext.get('email', '').strip().lower() if not email.endswith(f"@{ALLOWED_DOMAIN}"): raise ValueError("Signup is restricted to MyCompany employees only.") return super(CustomAuthSignup, self).do_signup(qcontext)

2. Modify Signup Form to Show Error Message

You can customize the signup page template to display a warning message if users enter an invalid email.

📌 Steps:

  1. Edit the views/auth_signup_login.xml file in your custom module.
  2. Add a validation script to check the email before submission.

📌 Example (JavaScript - Client-Side Validation):

javascript

CopyEdit

document.addEventListener("DOMContentLoaded", function () { document.querySelector("#signup_form").addEventListener("submit", function (event) { var email = document.querySelector("input[name='email']").value; if (!email.endsWith("@mycompany.com")) { alert("Signup is restricted to MyCompany employees only."); event.preventDefault(); } }); });

3. Hide Signup Option for Non-Company Emails

If you want to completely disable signup for external users, you can restrict the “Sign Up” button in the website settings:

📌 Steps:

  1. Go to Website > Configuration > Settings.
  2. Under Customer Accounts, select “Customers Only”.
  3. Enable Login Required to prevent public users from accessing the signup page.

Imagine profil
Abhay Singh
Cel mai bun răspuns

If you're not developer than this is the easiest solution you can implement by yourself:

  1. Go to Automated Actions:
    • In Odoo, navigate to "Settings" (or "Technical Settings" if you don't see Settings).
    • Search for "Automated Actions" and open it.
  2. Create a New Automated Action:
    • Click "Create".
  3. Configure the Automated Action:
    • Model: Select "Users" (res.users).
    • Trigger: Select "On Creation".
    • Apply on: Leave as "All Records" (or you can add a condition if needed).
    • Action To Do: Select "Execute Python Code".
  4. Python Code:
    • In the "Python Code" section, enter the following code:
# Allow only users with email ending in "@mycompany.com"
allowed_domain = "@mycompany.com"
user_email = record.email or record.login  # fallback to login if email is not set

if user_email and not user_email.lower().endswith(allowed_domain.lower()):
    raise UserError("Signup is restricted to users with @mycompany.com email addresses.")

5. Save and Close


If you know how to code then use this solution:
Add this code in some module or create your own custom module and add this code to fix it.

from odoo import models, fields, api
from odoo.exceptions import ValidationError

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

    @api.model
    def create(self, vals):
        if 'login' in vals and not vals['login'].endswith('@MyCompany.com'):
            raise ValidationError("Only users with @MyCompany.com email addresses can sign up.")
        return super(ResUsers, self).create(vals)


I hope it helps.

Thanks,
Abhay

1
Imagine profil
Abandonează
Imagine profil
Admin matprotect
Autor Cel mai bun răspuns

Hello,

Thank you for your answer, it is very helpful.

I am going the automated action way, however your code raises an error:

forbidden opcode(s) in '# Available variables:\n#  - env: environment on which the action is triggered\n#  - model: model of the record on which the action is triggered; is a void recordset\n#  - record: record on which the action is triggered; may be void\n#  - records: recordset of all records on which the action is triggered in multi-mode; may be void\n#  - time, datetime, dateutil, timezone: useful Python libraries\n#  - float_compare: utility function to compare floats based on specific precision\n#  - b64encode, b64decode: functions to encode/decode binary data\n#  - log: log(message, level=\'info\'): logging function to record debug information in ir.logging table\n#  - _logger: _logger.info(message): logger to emit messages in server logs\n#  - UserError: exception class for raising user-facing warning messages\n#  - Command: x2many commands namespace\n# To return an action, assign: action = {...}\n\nif record.login and "@MyCompany.com" not in record.login:\n    record.active = False\n    tag_id = env[\'ir.model.data\']._xmlid_to_res_id(\'your_module.invalid_email_tag\')  # Replace with your tag\'s XML ID\n    if tag_id:\n        record.write({\'category_id\': [(4, tag_id)]})\n    record.message_post(body="User deactivated and tagged: Invalid email domain. Only @MyCompany.com emails are allowed.")': STORE_ATTR

Any help with that?

0
Imagine profil
Abandonează
Abhay Singh

I updated my code in the original comment, try now and let me know if it works for you

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
E-Commerce
development shop
Imagine profil
Imagine profil
2
mar. 25
1810
Change the Checkout name in Odoo 18 Rezolvat
development workflow shop
Imagine profil
Imagine profil
2
iul. 25
1957
customizing print label
development system shop
Imagine profil
0
mar. 25
1377
MrpBom _skip_bom_line skips line of product that has two multi-choice attribute values when both are selected in Apply to variant
development
Imagine profil
1
nov. 25
136
How to make all branches for user active automatically after login his account?
development
Imagine profil
0
nov. 25
150
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now