mirror of
https://github.com/discourse/discourse.git
synced 2025-06-03 19:39:30 +08:00
DEV: Update confirm-email flows to use central 2fa and ember rendering (#25404)
These routes were previously rendered using Rails, and had a fairly fragile 2fa implementation in vanilla-js. This commit refactors the routes to be handled in the Ember app, removes the custom vanilla-js bundles, and leans on our centralized 2fa implementation. It also introduces a set of system specs for the behavior.
This commit is contained in:
29
lib/second_factor/actions/confirm_email.rb
Normal file
29
lib/second_factor/actions/confirm_email.rb
Normal file
@ -0,0 +1,29 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module SecondFactor::Actions
|
||||
class ConfirmEmail < Base
|
||||
def no_second_factors_enabled!(params)
|
||||
# handled in controller
|
||||
end
|
||||
|
||||
def second_factor_auth_required!(params)
|
||||
{
|
||||
callback_params: {
|
||||
token: params[:token],
|
||||
},
|
||||
redirect_url:
|
||||
(
|
||||
if @current_user
|
||||
"#{Discourse.base_path}/my/preferences/account"
|
||||
else
|
||||
"#{Discourse.base_path}/login"
|
||||
end
|
||||
),
|
||||
}
|
||||
end
|
||||
|
||||
def second_factor_auth_completed!(callback_params)
|
||||
# handled in controller
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user