Skip to Content Skip to Menu

restrict email to one domain only for registration

  • kommid
  • kommid
  • ONLINE
  • Posts: 67
  • Thanks: 12
  • Karma: 0
2 months 2 weeks ago #339062 by kommid
Hi,
I want users to use an email adress at a specific domain for registration (in order to ensure, that the user works for a specific company). Once they are registered, I want them to be able to change their email adresses to whatever email and domain they want.
When I set up a validation on the email field, this prevents users from changing their email to other domains even after registration.
What would I need to do to allow email-addresses@different.domains after registration only?

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
2 months 2 weeks ago - 2 months 2 weeks ago #339063 by krileon
Believe the only way you'll be able to have conditional validation like that is to move the validation to PHP. You can do so using Code Validation provided by CB Code Field. Under Integrations > CB Code Field you can enable PHP based custom validation to be applied to your email field where you can then verify the email domain only for registrations. Example as follows.

Code Validation: Enable
Code (PHP):
Code:
if ( $reason !== 'register' ) { return true; // This skips the validation on all other views except registration } return ( $value === 'PASS' ); // Here you can handle verifying the domain name
Ajax Validation: Enable

Note the above is just an example. I cannot help you with custom coding tasks. You will need to implement that verification yourself.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
Last edit: 2 months 2 weeks ago by krileon.
The following user(s) said Thank You: kommid

Please Log in or Create an account to join the conversation.

  • kommid
  • kommid
  • ONLINE
  • Posts: 67
  • Thanks: 12
  • Karma: 0
2 months 1 week ago #339087 by kommid
Thank you,
works like a charm.
The following user(s) said Thank You: krileon

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum