Skip to content

Unable to set my message from #inactive_message method #265

@vitaliiorlov

Description

@vitaliiorlov

Describe the bug

Hi!
I have defined #active_for_authentication? method in the User model according to the Devise documentation which can return false when I would like to disable login for users.

def active_for_authentication?
  super && ...
end

To show the reason why the user cannot log in I should define #inactive_message method in User model.

def inactive_message
  "My message"
end

But it doesn't work with this gem because in Login mutation you have such conditions.
Instead of my message, I saw a message that confirmation instructions were sent to my email address.

Steps to reproduce

  1. Define those methods in your User model:
def active_for_authentication?
  false
end

def inactive_message
  "My message"
end
  1. Try to log in.

Expected behavior

Show message from #inactive_message method.
By the way, #unauthenticated_message method also exists. Maybe it is worth supporting this method too.

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions