'Customizing authentication after soft deleting user by Discard gem in Ruby on Rails
I'm working on deleting users created by Devise with Discard; My issue is after deleting a user I want to customize the authentication:
This user shouldn't be able to login, but he should be able to register again with the same email.
In Discard documentation; they mentioned overriding active_for_authentication method in User model:
class User < ActiveRecord::Base
def active_for_authentication?
super && !discarded?
end
end
but this prevents both login and register.
Is there any other way to fix that?
I'm using:
gem "rails", "~> 6.1.4.1"
gem "discard", '~> 1.2'
gem "devise", "~> 4.8.0"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
