Ruby on Rails中,如何改写设计注销时无效真实性令牌的长尾词为?

2026-04-11 15:541阅读0评论SEO基础
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计278个文字,预计阅读时间需要2分钟。

Ruby on Rails中,如何改写设计注销时无效真实性令牌的长尾词为?

我的用户可以在myapp.com上登录,并将域名重定向到他们的子域名,例如username.myapp.com。这是有效的,因为我设置了Application.config.session_store为cookie_store,key为'domain_session',domain为':all'在session中。

我的用户可以在myapp.com上登录,并将其重定向到他们的子域,例如username.myapp.com

这是有效的,因为我有

Downhill::Application.config.session_store :cookie_store, :key => '_domain_session', :domain => :all

在session_store.rb&我的应用程序控制器中的一个方法,它根据用户名检查子域(因此您无法登录到其他用户的子域).

出于测试目的,username.myapp.com和myapp.com都会在登录后显示用户的数据.

问题是:当用户从username.myapp.com注销时,他们会得到

ActionController::InvalidAuthenticityToken in Devise::SessionsController#destroy

但是:当他们从myapp.com退出时,它就会退出.

有任何想法吗?

编辑

Ruby on Rails中,如何改写设计注销时无效真实性令牌的长尾词为?

我已经覆盖了after_sign_out_path_for和after_sign_in_path_for

def after_sign_out_path_for(resource) root_url end def after_sign_in_path_for(resource) dashboard_url(:subdomain => current_user.subdomain) end 我认为您的应用程序布局中缺少此行

<%= csrf_meta_tags %>

本文共计278个文字,预计阅读时间需要2分钟。

Ruby on Rails中,如何改写设计注销时无效真实性令牌的长尾词为?

我的用户可以在myapp.com上登录,并将域名重定向到他们的子域名,例如username.myapp.com。这是有效的,因为我设置了Application.config.session_store为cookie_store,key为'domain_session',domain为':all'在session中。

我的用户可以在myapp.com上登录,并将其重定向到他们的子域,例如username.myapp.com

这是有效的,因为我有

Downhill::Application.config.session_store :cookie_store, :key => '_domain_session', :domain => :all

在session_store.rb&我的应用程序控制器中的一个方法,它根据用户名检查子域(因此您无法登录到其他用户的子域).

出于测试目的,username.myapp.com和myapp.com都会在登录后显示用户的数据.

问题是:当用户从username.myapp.com注销时,他们会得到

ActionController::InvalidAuthenticityToken in Devise::SessionsController#destroy

但是:当他们从myapp.com退出时,它就会退出.

有任何想法吗?

编辑

Ruby on Rails中,如何改写设计注销时无效真实性令牌的长尾词为?

我已经覆盖了after_sign_out_path_for和after_sign_in_path_for

def after_sign_out_path_for(resource) root_url end def after_sign_in_path_for(resource) dashboard_url(:subdomain => current_user.subdomain) end 我认为您的应用程序布局中缺少此行

<%= csrf_meta_tags %>