Customize the lock error message with a variable of devise config

Viewed 192

Using devise as login framework, I tried to add the lock time in the lock error message of the file devise.en.yml, as below:

locked: "Your account is locked for %{config.unlock_in} minutes."

but the message does not change and the variable is not replaced by its value.

How can I do this, please ?

Thanks

1 Answers

I've customized the method def i18n_message of the class Devise::FailureApp and it is working for me. The idea is to do the same way that was done for the variable %{authentication_keys} inside this method.So, add the variable unlock_in as below:

options[:unlock_in] = scope_class.unlock_in
Related