Jump to content
  • 0

No public email address's on user registration


Question

Hi Guys,

I'm planning on using email verification when a new user registers however in addition to this I want to restrict users signing up with Hotmail or Gmail accounts.  My site is for corporate users only so their email address must be from their company domain.  What would be the best route to put some sort of field validation on the sign up form so if a user enters dave@hotmail.com the system stops them from clicking the submit button with a message of no public facing (i.e Hotmail or Gmail) email accounts allowed?

Many Thanks,

Mike.

Link to post
Share on other sites

8 answers to this question

Recommended Posts

  • 0

Hi @Majortom,

Your workflow requires custom JavaScript code, and for that very reason I've written the JS code below. It will be able to detect if the user inputted gmail or hot mail in your email field

<script>
document.querySelector('#caspioform').onsubmit = function(e) {
    e.preventDefault();

// Get User input
var UI= document.getElementById("InsertRecordFname").value;

//check if user used gmail
var gmail = UI.includes("gmail");

////check if user used hotmail
var hotmail = UI.includes("hotmail");

if ( gmail ==true) {
alert(' You are not allowed to use Gmail !');
}

else if ( hotmail ==true) {
alert(' You are not allowed to use Hotmail ! ');

}

else {
this.submit();
}

}
</script>

To use this solution follow the steps below

1.  Edit your DataPage, and ensure the form element of your email field / text box is to to email http://prntscr.com/m8kefp , it is one way of validation the user input to ensure it follows the correct email format xxxx@xxx.com

2. Insert a Header and Footer in your DataPage , click on the footer then click on' Source' and copy and paste the code above http://prntscr.com/m8kgo7

3. We need to get the ID of your email field for this solution to work, on your DataPage click on 'Preview' then on the preview mode press F12 on your keyboard to open developer mode http://prntscr.com/m8ki1l

4. While on developer mode press Ctrl + Shift + C on your keyboard or click on this button https://prnt.sc/m8kj41 and it should be highlighted, then click on your email field  and you should be able to see its element attribute just like on this screenshot http://prntscr.com/m8kjsp

5.  Double click on 'id' so that it will be highlighted, then press Ctrl + C to copy the ID http://prntscr.com/m8kkbv   

6. Go back to your DataPage, and go to the footer, then update the ID in our UI variable , refer to this screen shot http://prntscr.com/m8klvf

Once you have updated the the ID in our UI variable based on your email field we are all set to go, if you encounter any issue making this work tell. And I will be more than happy to assist you.

Regards,

TsiBiRu

Link to post
Share on other sites
  • 0

Hi TsiBiRu.

I have given the code a test and still allows me to submit a hotmail or gmail address.  Below is the code I have put into a footer and a screenshot from the debugger view:

<br />
<script>
document.querySelector('#caspioform').onsubmit = function(e) {
    e.preventDefault();

// Get User input
var UI= document.getElementById("InsertRecordContactEmail").value;

//check if user used gmail
var gmail = UI.includes("gmail");

////check if user used hotmail
var hotmail = UI.includes("hotmail");

if ( gmail ==true) {
alert(' You are not allowed to use Gmail !');
}

else if ( hotmail ==true) {
alert(' You are not allowed to use Hotmail ! ');

}

else {
this.submit();
}

}
</script>

 

Thank you again for all your help.

Mike

Debugger.jpg

Script.jpg

Link to post
Share on other sites
  • 0

Here is another possible solution. I have created a custom button in an HTML block that will serve as the submit button and placed this in a section. In another section I placed a message saying that only company email are allowed. Create a rule that when the email field contains 'gmail' or 'hotmail' hide the section with the custom button HTML block. Create a second rule that when email does not contain 'gmail' or 'hotmail' hide the section with the message.  You will need to edit the style applied as well to set the existing submit button to display:none;

Here is the demo page: https://c0cqk194.caspio.com/dp/d66730007687803bd8c348febbac

I attached the DataPage and associated dependencies so you can import and play around with. Just trying to provide a version without using any code as another option.

Enjoy!

 

CaspioData_2019-Jan-17_1518.zip

Link to post
Share on other sites
  • 0
12 hours ago, TsiBiRu said:

Hi @Majortom,

I apologize, I think I miss to mention something in my previous comment, you will need to disable the AJAX loading in your DataPage for our JavaScript solution to work  http://prntscr.com/m8n9j4

Kindly try this, and see if it will fix this. If it still will not work tell me and I will assist you. 

Regards,

TsiBiRu

Working fine now, thank you ever so much.

Mike

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...