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

[5.7] Ability to disable register route #25556

Merged
merged 1 commit into from Sep 10, 2018

Conversation

Projects
None yet
8 participants
@Cannonb4ll
Contributor

Cannonb4ll commented Sep 10, 2018

Sometimes you will want to disable registering in a application, this PR makes it possible to easily disable those routes.

Auth::routes(['register' => false]);
@JeroenBoesten

This comment has been minimized.

Contributor

JeroenBoesten commented Sep 10, 2018

I feel this should've been added a long time ago, needed this more than once, and it seems like a viable option since email verification now works in the same way.

@taylorotwell taylorotwell merged commit aac6144 into laravel:5.7 Sep 10, 2018

2 checks passed

continuous-integration/styleci/pr The analysis has passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@GrahamCampbell GrahamCampbell changed the title from Ability to disable register route to [5.7] Ability to disable register route Sep 11, 2018

@sisve

This comment has been minimized.

Contributor

sisve commented Sep 12, 2018

This sounds like something that should have tests. It sounds like a security problem if a dev sets up a site, disable registering, and we accidentally include the register routes again.

On a separate note, should the password reset also have this type of toggle?

@devcircus

This comment has been minimized.

Contributor

devcircus commented Sep 13, 2018

Never understood why you would hide routes behind a method anyway. Your routes file should be explicit. Quicker to do it manually than to use this new option, if you know how to use your editor.

@browner12

This comment has been minimized.

Contributor

browner12 commented Sep 13, 2018

yah, I personally would prefer we got rid of Auth::routes(), but I don't think that's happening anytime soon.

@yajra

This comment has been minimized.

Contributor

yajra commented Sep 14, 2018

Thanks @Cannonb4ll, sent a related PR #19452 but failed. Glad this went through! Less codes with clean implementation at least for me. No more if to toggle register. :)

Auth::routes([
    'verify'   => true
    'register' => config('site.registration', true),
]);
@shadoWalker89

This comment has been minimized.

Contributor

shadoWalker89 commented Sep 26, 2018

@yajra yeah me too,
Done the same exact thing a long time ago #16961

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