Last active
July 11, 2020 09:12
-
-
Save warrenlalata/234172b2bb19fb0c7ae285c3b5b7986a to your computer and use it in GitHub Desktop.
Devise admin only login [https://stackoverflow.com/questions/47222529/devise-allow-only-admin-to-sign-in]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem "devise_custom_authenticatable" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
devise :custom_authenticatable, | |
:database_authenticatable, | |
:registerable, | |
:recoverable, | |
:rememberable, | |
:validatable | |
def valid_for_custom_authenticatable?(password) | |
self.has_role?(:admin) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment