How can I sign out a devise user from the Rails console?

前端 未结 7 1732
一个人的身影
一个人的身影 2021-02-06 21:53

My devise users are \"database_authenticatable\" and \"token_authenticatable\". I\'ve tried deleting the \"authentication_token\" field in the database for that user from the co

7条回答
  •  别跟我提以往
    2021-02-06 22:17

    I believe you can simply update the password_salt and it will invalidate the user session on their next request.

    user = User.first
    user.update_column(:password_salt, 'reset')    
    

    Reference: http://www.jonathanleighton.com/articles/2013/revocable-sessions-with-devise/

提交回复
热议问题