The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/printthread.php 16 require_once
Warning [2] Undefined property: MyLanguage::$archive_pages - Line: 2 - File: printthread.php(287) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/printthread.php(287) : eval()'d code 2 errorHandler->error
/printthread.php 287 eval
/printthread.php 117 printthread_multipage



UserSpice
Registration only allowed with specific domain - Printable Version

+- UserSpice (https://userspice.com/forums)
+-- Forum: Miscellaneous (https://userspice.com/forums/forumdisplay.php?fid=28)
+--- Forum: Modifications and Hackery (https://userspice.com/forums/forumdisplay.php?fid=29)
+--- Thread: Registration only allowed with specific domain (/showthread.php?tid=696)

Pages: 1 2


Registration only allowed with specific domain - jcoleswork - 08-29-2017

Is there a way to only allow people with a specific domain in their email to be able to register?
I cant seem to find any documentation on that?

Thanks


Registration only allowed with specific domain - Brandin - 08-29-2017

Use this:
http://www.bitrepository.com/how-to-extract-domain-name-from-an-e-mail-address-string.html

And basically add the validation before the insert.


Registration only allowed with specific domain - jcoleswork - 08-30-2017

Thank you, i'll check that out and implement it


Registration only allowed with specific domain - jcoleswork - 08-30-2017

I added this on line 133 of join.php
<pre>
Code:
    if (substr(strrchr($email, "@"), 1) != "url.com"){
        $validation->addError([$domain."You can only register from a valid url.com email address."]);
    }
</pre>


This seems to be working exactly how I wanted it to.
Thanks


Registration only allowed with specific domain - mudmin - 08-30-2017

Awesome! Glad you got it sorted!

Since you edited the actual join.php, just keep an eye out for updates that change that file.

Another way you could do it is to copy join.php over to usersc/join.php

Change line 24 to
Code:
<?php require_once '../users/init.php'; ?>

Then your changes will not get overwritten by updates. With that particular change I don't think you'll have to make a change to users/views/_join.php so I think you're good to go.


Registration only allowed with specific domain - jcoleswork - 08-30-2017

Thanks for the advice, ill deff do that before i loose anything.

I love your schmidt picture btw, he is the man. Hopefully Rhys can bring the phils back to their 80,08 eras!!!


Registration only allowed with specific domain - Brandin - 08-30-2017

Awesome to hear you got this to work!

If there is enough interest - we can work on incorporating this into the system in some way, maybe a allowed_addresses database or something and do a pull if the setting is enabled

But I don't want to work on this unless there is promising interest from some of our users




Registration only allowed with specific domain - mudmin - 08-30-2017

Yes! Rhys won't keep up his current pace, but it's nice to have something to be excited about before the eagles season starts!


Registration only allowed with specific domain - mudmin - 08-30-2017

I actually have some interest. I think it makes sense to be able to just whitelist your work domain(s) for corporate projects.

I think the google/facebook sign in would be tricky.

Btw, I did a new project using fb and they changed their oauth again so I updated the documentation. There is also a bug caused by using fb with usersc/login and I have that fixed...just waiting for @karsen's updates to push it.


Registration only allowed with specific domain - Brandin - 08-31-2017

Google/Facebook sign in would be - but - if you're whitelisting for your work domains, you would probably not want to work with oAuth anyway - unless your org uses Google Apps. In my case, I have oAuth disabled since I don't want my coworkers registering that way.