Last active
June 9, 2016 16:56
-
-
Save tsolar/a8b0c04138b010f2d02206ed44c95ccd to your computer and use it in GitHub Desktop.
Permitir sólo a algunos emails acceder a la app en Rails
This file contains hidden or 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
# from http://www.rubydoc.info/github/plataformatec/devise/master/Devise/Models/Authenticatable | |
# Poner en el modelo User | |
def special_condition_is_valid? | |
permitted_emails = [ | |
# Poner acá los emails permitidos para acceder | |
"[email protected]", | |
"[email protected]" | |
] | |
if permitted_emails.include?(self.email) | |
return true | |
else | |
return false | |
end | |
end | |
def active_for_authentication? | |
super && special_condition_is_valid? | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment