Passa al contenuto
Odoo Menu
  • Accedi
  • Provalo gratis
  • App
    Finanze
    • Contabilità
    • Fatturazione
    • Note spese
    • Fogli di calcolo (BI)
    • Documenti
    • Firma
    Vendite
    • CRM
    • Vendite
    • Punto vendita Negozio
    • Punto vendita Ristorante
    • Abbonamenti
    • Noleggi
    Siti web
    • Configuratore sito web
    • E-commerce
    • Blog
    • Forum
    • Live chat
    • E-learning
    Supply chain
    • Magazzino
    • Produzione
    • PLM
    • Acquisti
    • Manutenzione
    • Qualità
    Risorse umane
    • Dipendenti
    • Assunzioni
    • Ferie
    • Valutazioni
    • Referral dipendenti
    • Parco veicoli
    Marketing
    • Social marketing
    • E-mail marketing
    • SMS marketing
    • Eventi
    • Marketing automation
    • Sondaggi
    Servizi
    • Progetti
    • Fogli ore
    • Assistenza sul campo
    • Helpdesk
    • Pianificazione
    • Appuntamenti
    Produttività
    • Comunicazioni
    • Approvazioni
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    App di terze parti Odoo Studio Piattaforma cloud Odoo
  • Settori
    Retail
    • Libreria
    • Negozio di abbigliamento
    • Negozio di arredamento
    • Alimentari
    • Ferramenta
    • Negozio di giocattoli
    Cibo e ospitalità
    • Bar e pub
    • Ristorante
    • Fast food
    • Pensione
    • Grossista di bevande
    • Hotel
    Agenzia immobiliare
    • Agenzia immobiliare
    • Studio di architettura
    • Edilizia
    • Gestione immobiliare
    • Impresa di giardinaggio
    • Associazione di proprietari immobiliari
    Consulenza
    • Società di contabilità
    • Partner Odoo
    • Agenzia di marketing
    • Studio legale
    • Selezione del personale
    • Audit e certificazione
    Produzione
    • Tessile
    • Metallo
    • Arredamenti
    • Alimentare
    • Birrificio
    • Ditta di regalistica aziendale
    Benessere e sport
    • Club sportivo
    • Negozio di ottica
    • Centro fitness
    • Centro benessere
    • Farmacia
    • Parrucchiere
    Commercio
    • Tuttofare
    • Hardware e assistenza IT
    • Ditta di installazione di pannelli solari
    • Calzolaio
    • Servizi di pulizia
    • Servizi di climatizzazione
    Altro
    • Organizzazione non profit
    • Ente per la tutela ambientale
    • Agenzia di cartellonistica pubblicitaria
    • Studio fotografico
    • Punto noleggio di biciclette
    • Rivenditore di software
    Carica tutti i settori
  • Community
    Apprendimento
    • Tutorial
    • Documentazione
    • Certificazioni 
    • Formazione
    • Blog
    • Podcast
    Potenzia la tua formazione
    • Programma educativo
    • Scale Up! Business Game
    • Visita Odoo
    Ottieni il software
    • Scarica
    • Versioni a confronto
    • Note di versione
    Collabora
    • Github
    • Forum
    • Eventi
    • Traduzioni
    • Diventa nostro partner
    • Servizi per partner
    • Registra la tua società di contabilità
    Ottieni servizi
    • Trova un partner
    • Trova un contabile
    • Incontra un esperto
    • Servizi di implementazione
    • Testimonianze dei clienti
    • Supporto
    • Aggiornamenti
    GitHub Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Richiedi una demo
  • Prezzi
  • Aiuto

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

  • CRM
  • e-Commerce
  • Contabilità
  • Magazzino
  • PoS
  • Progetti
  • MRP
All apps
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
È necessario essere registrati per interagire con la community.
Tutti gli articoli Persone Badge
Etichette (Mostra tutto)
odoo accounting v14 pos v15
Sul forum
Assistenza

Restrict ecommerce website signup to certain email domain

Iscriviti

Ricevi una notifica quando c'è un'attività per questo post

La domanda è stata contrassegnata
developmentshop
2 Risposte
1780 Visualizzazioni
Avatar
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
Avatar
Abbandona
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.

Avatar
Abhay Singh
Risposta migliore

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
Avatar
Abbandona
Avatar
Admin matprotect
Autore Risposta migliore

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
Avatar
Abbandona
Abhay Singh

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

Ti stai godendo la conversazione? Non leggere soltanto, partecipa anche tu!

Crea un account oggi per scoprire funzionalità esclusive ed entrare a far parte della nostra fantastica community!

Registrati
Post correlati Risposte Visualizzazioni Attività
E-Commerce
development shop
Avatar
Avatar
2
mar 25
1879
Change the Checkout name in Odoo 18 Risolto
development workflow shop
Avatar
Avatar
2
lug 25
2045
customizing print label
development system shop
Avatar
0
mar 25
1455
How do I change the name of the module, or rather the name assigned to the module, after I created it in Odoo Studio?
development
Avatar
1
nov 25
200
Guest House Module - Rental Search Bar
development
Avatar
Avatar
1
nov 25
98
Community
  • Tutorial
  • Documentazione
  • Forum
Open source
  • Scarica
  • Github
  • Runbot
  • Traduzioni
Servizi
  • Hosting Odoo.sh
  • Supporto
  • Aggiornamenti
  • Sviluppi personalizzati
  • Formazione
  • Trova un contabile
  • Trova un partner
  • Diventa nostro partner
Chi siamo
  • La nostra azienda
  • Branding
  • Contattaci
  • Lavora con noi
  • Eventi
  • Podcast
  • Blog
  • Clienti
  • Note legali • Privacy
  • Sicurezza
الْعَرَبيّة 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 è un gestionale di applicazioni aziendali open source pensato per coprire tutte le esigenze della tua azienda: CRM, Vendite, E-commerce, Magazzino, Produzione, Fatturazione elettronica, Project Management e molto altro.

Il punto di forza di Odoo è quello di offrire un ecosistema unico di app facili da usare, intuitive e completamente integrate tra loro.

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