feat: Ability for the logged in user to create a new account (#985)

Co-authored-by: Divyesh <dkothari@box8.in>
Co-authored-by: Pranav Raj S <pranav@thoughtwoot.com>
This commit is contained in:
Divyesh Kothari
2020-07-26 12:54:50 +05:30
committed by GitHub
parent 858b72a404
commit 89ed0b425b
13 changed files with 219 additions and 28 deletions

View File

@@ -14,14 +14,15 @@ class Api::V1::AccountsController < Api::BaseController
with: :render_error_response
def create
@user = AccountBuilder.new(
@user, @account = AccountBuilder.new(
account_name: account_params[:account_name],
email: account_params[:email],
confirmed: confirmed?
confirmed: confirmed?,
user: current_user
).perform
if @user
send_auth_headers(@user)
render partial: 'devise/auth.json', locals: { resource: @user }
render 'api/v1/accounts/create.json', locals: { resource: @user }
else
render_error_response(CustomExceptions::Account::SignupFailed.new({}))
end