簡體   English   中英

Rails-Devise-登錄后防止重定向

[英]Rails - Devise - prevent redirecting after sign in

登錄后,我也將使“注冊”按鈕起作用,但是當我單擊該按鈕時,它將重定向到根路徑。

我認為是因為過濾器。

RegistrationController代碼:

class RegistrationsController < ApplicationController
  prepend_before_filter :require_no_authentication, :only => [ :new, :create, :after_registration ]
  prepend_before_filter :authenticate_scope!, :only => [:edit, :update, :destroy]
  include Devise::Controllers::InternalHelpers

  # GET /resource/sign_up
  def new
    build_resource
    render_with_scope :new
  end
...

注冊頁面的網址是/ users / sign_up

任何想法? 謝謝。

你是對的。 這是由於:require_no_authentication方法而發生的。 它確保用戶未通過身份驗證,如果用戶經過身份驗證,則將其重定向。

我想在您的情況下,您可以在過濾器之前將其刪除。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM