How to override devise unlock

418 views
Skip to first unread message

thiagocifani

unread,
Oct 18, 2011, 3:10:34 PM10/18/11
to plataforma...@googlegroups.com
Hello dude, I need to override the devise unlock method, cause in my application I need to redirect my user to other page if he/she is locked. I cannot figure it out, And I need some help. The page I get when I try to access a locked account is email me page, but I need to make other things, like allow user to get some credits if he/she account is locked. Is it possible? how can I override this method?


thiagocifani

unread,
Oct 19, 2011, 8:53:43 PM10/19/11
to Devise
<pt-br> olá, tenho que sobrescrever o método de unlock do devise para
redirecionar para uma pagina de retirar de creditos no meu sistema!
não sei se bloquear o usuario pelo locked_at seria a melhor
alternativa! mas pensei nela! se o usuario tiver bloqueado, gostaria
de redirecionar para uma pagina personalizada onde ele ao pudesse
fazer mais nada alem de preencher uns campos com o pedido dele! Se
puder me ajudar agradeceria!

abraço
> <http://del.icio.us/thiagocifani>

Carlos Antonio da Silva

unread,
Oct 20, 2011, 6:46:47 AM10/20/11
to plataforma...@googlegroups.com
If the user is locked, Devise is going to redirect you back to the failing page (probably the sign in). To change that, you'd have to create a custom FailureApp changing the redirect url only if the error was related to locking the user. 

Anyway, I don't think this is the right usage of the lockable module. It's supposed to provide you with lock abilities if the user tries to access his/her account with some invalid attempts, allowing he/she to unlock it using some strategies (time box, email, whatever).

You're locking the user asking for more credits, right? It seems more a new implementation you should work out, than related to Devise's lockable module.
--
At.
Carlos Antonio

Rogerio Medeiros

unread,
Oct 20, 2011, 7:02:03 AM10/20/11
to plataforma...@googlegroups.com
Opa Thiago blz ?

Da uma olhada se isso te ajuda, pelo que eu entendi seria na hora que o usuario se logar certo ?

Senao voce pode dar uma outra implementada, lol

Coloca isso no application_controller


Tu pode fazer isso tambem para cada um de seus roles. É como eu uso aqui

2011/10/19 thiagocifani <cifani...@gmail.com>



--
att,

Rogerio

A complicação se descomplica na mesma proporção que fazemos os nós se desatarem ao tecer o conhecimento do saber.

thiagocifani

unread,
Oct 20, 2011, 8:15:27 AM10/20/11
to plataforma...@googlegroups.com
Thank you so much antonio and Rogerio. Worked to me using can can


thanks
Reply all
Reply to author
Forward
0 new messages