628a43ef61
Include identity.id in the my/identity.json response and return an empty body from the CREATE signup/completions.json endpoint. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
43 lines
960 B
Ruby
43 lines
960 B
Ruby
class Signups::CompletionsController < ApplicationController
|
|
layout "public"
|
|
|
|
disallow_account_scope
|
|
|
|
def new
|
|
@signup = Signup.new(identity: Current.identity)
|
|
end
|
|
|
|
def create
|
|
@signup = Signup.new(signup_params)
|
|
|
|
if @signup.complete
|
|
welcome_to_account
|
|
else
|
|
invalid_signup
|
|
end
|
|
end
|
|
|
|
private
|
|
def signup_params
|
|
params.expect(signup: %i[ full_name ]).with_defaults(identity: Current.identity)
|
|
end
|
|
|
|
def welcome_to_account
|
|
respond_to do |format|
|
|
format.html do
|
|
flash[:welcome_letter] = true
|
|
redirect_to landing_url(script_name: @signup.account.slug)
|
|
end
|
|
|
|
format.json { head :created }
|
|
end
|
|
end
|
|
|
|
def invalid_signup
|
|
respond_to do |format|
|
|
format.html { render :new, status: :unprocessable_entity }
|
|
format.json { render json: { errors: @signup.errors.full_messages }, status: :unprocessable_entity }
|
|
end
|
|
end
|
|
end
|