Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default domain for username registration #89

Open
nwaughachukwuma opened this issue Apr 17, 2017 · 4 comments
Open

Default domain for username registration #89

nwaughachukwuma opened this issue Apr 17, 2017 · 4 comments

Comments

@nwaughachukwuma
Copy link

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?

@sroutier
Copy link
Collaborator

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?

@nwaughachukwuma
Copy link
Author

nwaughachukwuma commented Aug 23, 2017

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 [email protected] 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

@sroutier
Copy link
Collaborator

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

@nwaughachukwuma
Copy link
Author

Awesome. Thanks a lot. Can't wait to begin exploring the new version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants