Overriding default Clearance routes

Hi everyone,

I’m trying to override/remove the following default routes set by Clearance.

get '/sign_in' => 'clearance/sessions#new', :as => 'sign_in'
get '/sign_up' => 'clearance/users#new', :as => 'sign_up'

Ideally what I’d like to do is change the ‘/sign_in’ path to ‘/admin/sign_in’ and to remove the ‘/sign_up’ path/view altogether. I can get the ‘admin/sign_in’ path working via:

get '/admin/sign_in', to: 'clearance/sessions#new'

So I just want to remove the two default routes set by Clearance. I’ve looked around and there doesn’t seem to be any easy way to do this?

Appreciate any suggestions.

Thanks in advance!

1 Like

Hello @ralphwintle,

It seems that basically you want do disable sign ups. If so, there is a pull request for this already, you can view it at Allow sign up to be disabled via configuration by JoelQ · Pull Request #368 · thoughtbot/clearance · GitHub.

You can wait for that to get merged or, if this is urgent, just fork the gem and apply this for yourself. Then update when it does get merged.

Hope this helps :slight_smile:

Oh awesome. Thanks. I should have checked the pull requests tab :smile:

I’ll probably wait around till it gets merged, although I suspect I may have to still fork the gem to change the ‘/sign_in’ path to the something like ‘/admin/sign_in’.

No problem, glad to help :slight_smile: