Add polling and automatic redirection to /start
on email confirmation (#25013)
This commit is contained in:
parent
2ce0b666a1
commit
e60414792d
5 changed files with 94 additions and 3 deletions
|
@ -1,9 +1,10 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Api::V1::Emails::ConfirmationsController < Api::BaseController
|
||||
before_action -> { doorkeeper_authorize! :write, :'write:accounts' }
|
||||
before_action :require_user_owned_by_application!
|
||||
before_action :require_user_not_confirmed!
|
||||
before_action -> { authorize_if_got_token! :read, :'read:accounts' }, only: :check
|
||||
before_action -> { doorkeeper_authorize! :write, :'write:accounts' }, except: :check
|
||||
before_action :require_user_owned_by_application!, except: :check
|
||||
before_action :require_user_not_confirmed!, except: :check
|
||||
|
||||
def create
|
||||
current_user.update!(email: params[:email]) if params.key?(:email)
|
||||
|
@ -12,6 +13,10 @@ class Api::V1::Emails::ConfirmationsController < Api::BaseController
|
|||
render_empty
|
||||
end
|
||||
|
||||
def check
|
||||
render json: current_user.confirmed?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def require_user_owned_by_application!
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue