mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 06:14:12 +08:00
FEATURE: add email query param to login, signup, and password-reset URLs to prefill form
This commit is contained in:
@ -6,8 +6,10 @@ class StaticController < ApplicationController
|
||||
skip_before_filter :check_xhr, :redirect_to_login_if_required
|
||||
skip_before_filter :verify_authenticity_token, only: [:cdn_asset, :enter, :favicon]
|
||||
|
||||
PAGES_WITH_EMAIL_PARAM = ['login', 'password_reset', 'signup']
|
||||
|
||||
def show
|
||||
return redirect_to(path '/') if current_user && params[:id] == 'login'
|
||||
return redirect_to(path '/') if current_user && (params[:id] == 'login' || params[:id] == 'signup')
|
||||
|
||||
map = {
|
||||
"faq" => {redirect: "faq_url", topic_id: "guidelines_topic_id"},
|
||||
@ -44,6 +46,10 @@ class StaticController < ApplicationController
|
||||
return
|
||||
end
|
||||
|
||||
if PAGES_WITH_EMAIL_PARAM.include?(@page) && params[:email]
|
||||
cookies[:email] = { value: params[:email], expires: 1.day.from_now }
|
||||
end
|
||||
|
||||
file = "static/#{@page}.#{I18n.locale}"
|
||||
file = "static/#{@page}.en" if lookup_context.find_all("#{file}.html").empty?
|
||||
file = "static/#{@page}" if lookup_context.find_all("#{file}.html").empty?
|
||||
|
Reference in New Issue
Block a user