I'm using devise
for authentication and have a activated:boolean
on users
table.
How can I only allow the activated users to sign in? And show the flash message:
Login successful
for users activated and Login denied
for users non-activated
/ deactivated
users
Thanks!
To prevent deactivated users from signing in, override active_for_authentication?
on your User
model:
def active_for_authentication?
super && activated
end
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.