restrict registration to user with certain emails

Discussion in 'ClassiCraft WordPress Theme' started by rozzir, Feb 23, 2015.

  1. rozzir

    rozzir Guest

    Joined:
    Jan 30, 2015
    Messages:
    5
    Likes Received:
    0
    Hi, How can I restrict registration to user with emails only from my company (for example [email protected])?
     
  2. Pramod

    Pramod Guest

    Joined:
    Aug 8, 2014
    Messages:
    2,847
    Likes Received:
    63
    Hello !

    Do you want to use only your company's email id for register or restrict it?
    It required code customization in library/control/user_auth.php

    Thanks & Regards
    Pramod
     
  3. rozzir

    rozzir Guest

    Joined:
    Jan 30, 2015
    Messages:
    5
    Likes Received:
    0
    Thanks for your reply, what I meant is I want to restrict registering to user with emails that have extension @mycompany.com (which means forcing people to use their work email and also not letting anyone from outside to register)
     
  4. Pramod

    Pramod Guest

    Joined:
    Aug 8, 2014
    Messages:
    2,847
    Likes Received:
    63
    Hello !

    Code:
    var emailReg2 =/^([\w-\.]+@(?![EMAIL='[email protected]']mycompany.co.uk[/EMAIL])([\w-]+\.)+[\w-]{2,4})?$/
                            if (jQuery("#email").val() == "") {
                                user_email.addClass("error");
                                user_email_error.text("Please provide your email address");
                                user_email_error.addClass("error");
                                return false;
                            } else if (!emailReg.test(jQuery("#email").val())) {
                                user_email.addClass("error");
                                user_email_error.text("Please provide valid email address");
                                user_email_error.addClass("error");
                                return false;
                            } else if (!emailReg2.test(jQuery("#email").val())) {
                                user_email.addClass("error");
                                user_email_error.text("This is not a valid email address");
                                user_email_error.addClass("error");
                                return false;
                            }
                            else {
                                user_email.removeClass("error");
                                user_email_error.text("");
                                user_email_error.removeClass("error");
                                return true;
                            }
    Please follow below image to use given code.
    classi-emailban-26-feb.png

    Thanks & Regards
    Pramod Patel
     

Share This Page