Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
in Plugins by

Say, my domain name is example.com. And I'm using Google Apps for Work. So, I'm having all google services with my email address like: abc@example.com. That means abc@example.com is now working like gmail account..

I've installed this question2answer and using q2a-open-login plugin to register user using Google login. And want to allow the users having email address like xxx@example.com. I want to restrict other domain specific email address to register/login.

How to achive that? Please help.

Q2A version: 1.6.3

1 Answer

+3 votes
edited by
Best answer

Check this function which validates the email address .


Here you can make lil bit changes which check the email should ends with your domain name .


for openlogin add the validation lines before this - https://github.com/alixandru/q2a-open-login/blob/master/qa-open-overrides.php#L134

 // For redirect

qa_redirect('' , array('state' => ($login_error ? 'login-error' : 'login-succ')));
// then after rediret to show the error message 
$state = qa_get_state();
if ($state == 'login-error')
$pageerror = "Login Unsuccessful . Please check your email address .. Blah blah ";
$qa_content['error'] = @$pageerror;

Hope this helps


Thanks Amiya, but it's only filtering when user gets manually registered not when authenticating through Google Login! :(
in open login plugin here it creates a user .


Add your validatations before that .

I will update the answer as well .
Great!!! it worked. Thank you so much! could you please help little more? how could I redirect that not-allowed user to home page along with a error message. Is there any predefined function in q2a?
I have updated the answer . Please check