Open nwaughachukwuma opened 7 years ago
Hello @nwaughachukwuma , apologies for the late reply. Nothing in LESK to force the restrictions that you have in mind at the moment but we could always keep such an idea on the radar for the next version. Ideally putting this in a module may make more sense. Do you have an implementation that you can share?
Hi @sroutier, apologies from me too. We ended up using jQuery to validate the form from the frontend, by adding a domain name as a suffix, such that admin can only add the first part of the user's email as prefix. Let me explain: Say for instance, the domain name is @abc.com, we use @abc.com as the email suffix, such that if a user with official email address xyz@abc.com is to be created, the admin would add xyz to the already existing suffix (@abc.com). This way, using a different domain name raises a modal that show an error message.
After this, we went into the CreateUserRequest in App/Http/Request and updated the rules for email to use a regex with the domain name. Something like this '*email' => 'required|unique:users|regex:/^[\w]+(.[\w]+)(@abc.com)+$/i',** This is a rough fix, but it solved the problem. However, I feel there is a better way to achieve this. Hoping to hear from you soon. Thanks
The way that you did it, looks pretty good. Works for you, that is probably the most important factor. I am currently working to prepare a new version of LESK based on Laravel 5.5 and in that next version, a lot of events are fired at various points. So, in theory, all you would have to do is create a new event listener and perform all the processing in it that you need. But that is in the future... Until then your approach works. I'll leave this issue open to track it, it will be a quick and easy module to add to the next version.
Ciao. /s
Awesome. Thanks a lot. Can't wait to begin exploring the new version.
Hi @sroutier and everybody,
I am using this starter kit to implement a web application that's intended for use within organizations. This implies that users cannot create themselves by signing up, but are created by system admin, and can subsequently login after they are created. This is working fine. But I want admin to only create users working in the organization, and have official email addresses i.e. email addresses with companies domain name. Is there a way to configure this app, probably at config/auth.php to have a default domain for user registration, such that admin cannot register anyone outside the organization, and also such that, as an additional feature, users login with their username, and the system adds the domain name automatically?