如何更改Devise身份验证属性(How to change Devise authentication attribute)

嘿伙计们使用这个Devise模型: https : //github.com/plataformatec/devise/wiki/How-To%3a-Require-admin-to-activate-account-before-sign_in

有谁知道我可以在哪里更改它,以便Devise使用我的is_approved而不是默认approved ?

由于某种原因,我不能使用默认approved因为sqlite不会更新bool属性更多信息在这里: Rails 3和SQLite通信有关boolians

在我的网站上批准用户后,设备会出现“用户未批准”的错误,但我无法在我的应用程序中找到可以更改此内容的位置?

Hey guys im using this Devise model : https://github.com/plataformatec/devise/wiki/How-To%3a-Require-admin-to-activate-account-before-sign_in

do anyone know where i can change it so that Devise uses my is_approved instead of the default approved ?

for some reason i cant use the default approved since sqlite wont update the bool attribute more info about that here : Rails 3 and SQLite communications concerning boolians

After i have approved a user on my website Device gives an error "user not approved" but i cant find in my app where i can change this ?

最满意答案

没关系,我发现它,它是如此明显,我几乎不想分享它大声笑

但如果有人想知道它,那么你只需要改变

def active_for_authentication? super && "your attribute"? end def inactive_message if !"your attribute"? :not_approved else super # Use whatever other message end end

我放置“你的属性”的2个地方应该在你的用户模型中

Never mind i found it, it was so obvious that i almost dont want to share it lol

but in case anyone is ever wondering about it, then you just have to change

def active_for_authentication? super && "your attribute"? end def inactive_message if !"your attribute"? :not_approved else super # Use whatever other message end end

the 2 places where i put "your attribute" this should be in your user model

如何更改Devise身份验证属性(How to change Devise authentication attribute)

嘿伙计们使用这个Devise模型: https : //github.com/plataformatec/devise/wiki/How-To%3a-Require-admin-to-activate-account-before-sign_in

有谁知道我可以在哪里更改它,以便Devise使用我的is_approved而不是默认approved ?

由于某种原因,我不能使用默认approved因为sqlite不会更新bool属性更多信息在这里: Rails 3和SQLite通信有关boolians

在我的网站上批准用户后,设备会出现“用户未批准”的错误,但我无法在我的应用程序中找到可以更改此内容的位置?

Hey guys im using this Devise model : https://github.com/plataformatec/devise/wiki/How-To%3a-Require-admin-to-activate-account-before-sign_in

do anyone know where i can change it so that Devise uses my is_approved instead of the default approved ?

for some reason i cant use the default approved since sqlite wont update the bool attribute more info about that here : Rails 3 and SQLite communications concerning boolians

After i have approved a user on my website Device gives an error "user not approved" but i cant find in my app where i can change this ?

最满意答案

没关系,我发现它,它是如此明显,我几乎不想分享它大声笑

但如果有人想知道它,那么你只需要改变

def active_for_authentication? super && "your attribute"? end def inactive_message if !"your attribute"? :not_approved else super # Use whatever other message end end

我放置“你的属性”的2个地方应该在你的用户模型中

Never mind i found it, it was so obvious that i almost dont want to share it lol

but in case anyone is ever wondering about it, then you just have to change

def active_for_authentication? super && "your attribute"? end def inactive_message if !"your attribute"? :not_approved else super # Use whatever other message end end

the 2 places where i put "your attribute" this should be in your user model