diff --git a/app/javascript/v3/views/login/Index.vue b/app/javascript/v3/views/login/Index.vue
index d840c27a5..8be74e709 100644
--- a/app/javascript/v3/views/login/Index.vue
+++ b/app/javascript/v3/views/login/Index.vue
@@ -46,6 +46,7 @@
name="email_address"
type="text"
data-testid="email_input"
+ :tabindex="1"
required
:label="$t('LOGIN.EMAIL.LABEL')"
:placeholder="$t('LOGIN.EMAIL.PLACEHOLDER')"
@@ -58,19 +59,25 @@
name="password"
data-testid="password_input"
required
+ :tabindex="2"
:label="$t('LOGIN.PASSWORD.LABEL')"
:placeholder="$t('LOGIN.PASSWORD.PLACEHOLDER')"
:has-error="$v.credentials.password.$error"
@input="$v.credentials.password.$touch"
>
-
+
{{ $t('LOGIN.FORGOT_PASSWORD') }}
From ea94a1aff61d0252935d3ef98361a4eeab9295d1 Mon Sep 17 00:00:00 2001
From: Nithin David Thomas <1277421+nithindavid@users.noreply.github.com>
Date: Wed, 14 Feb 2024 19:33:24 +0530
Subject: [PATCH 2/5] feat: API changes to support multi step user signup
---
app/builders/account_builder.rb | 6 +++---
app/controllers/api/v1/accounts_controller.rb | 2 --
app/models/user.rb | 2 --
3 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/app/builders/account_builder.rb b/app/builders/account_builder.rb
index f179c6405..32fb5c44b 100644
--- a/app/builders/account_builder.rb
+++ b/app/builders/account_builder.rb
@@ -2,7 +2,7 @@
class AccountBuilder
include CustomExceptions::Account
- pattr_initialize [:account_name, :email!, :confirmed, :user, :user_full_name, :user_password, :super_admin, :locale]
+ pattr_initialize [:email!, :confirmed, :user, :user_password, :super_admin, :locale]
def perform
if @user.nil?
@@ -49,7 +49,7 @@ class AccountBuilder
end
def create_account
- @account = Account.create!(name: account_name, locale: I18n.locale)
+ @account = Account.create!(name: '', locale: I18n.locale)
Current.account = @account
end
@@ -74,7 +74,7 @@ class AccountBuilder
@user = User.new(email: @email,
password: user_password,
password_confirmation: user_password,
- name: user_full_name)
+ name: '')
@user.type = 'SuperAdmin' if @super_admin
@user.confirm if @confirmed
@user.save!
diff --git a/app/controllers/api/v1/accounts_controller.rb b/app/controllers/api/v1/accounts_controller.rb
index 481594ee4..0d4ad36b7 100644
--- a/app/controllers/api/v1/accounts_controller.rb
+++ b/app/controllers/api/v1/accounts_controller.rb
@@ -23,8 +23,6 @@ class Api::V1::AccountsController < Api::BaseController
def create
@user, @account = AccountBuilder.new(
- account_name: account_params[:account_name],
- user_full_name: account_params[:user_full_name],
email: account_params[:email],
user_password: account_params[:password],
locale: account_params[:locale],
diff --git a/app/models/user.rb b/app/models/user.rb
index ba638f637..a8467aafc 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -68,8 +68,6 @@ class User < ApplicationRecord
# work because :validatable in devise overrides this.
# validates_uniqueness_of :email, scope: :account_id
- validates :email, presence: true
-
has_many :account_users, dependent: :destroy_async
has_many :accounts, through: :account_users
accepts_nested_attributes_for :account_users
From 11886a4e5eb5cb26743ca20dfd20d6f3c93a8e08 Mon Sep 17 00:00:00 2001
From: Nithin David Thomas <1277421+nithindavid@users.noreply.github.com>
Date: Wed, 14 Feb 2024 19:38:57 +0530
Subject: [PATCH 3/5] Exposes meta data of company to response
---
app/views/api/v1/models/_account.json.jbuilder | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/app/views/api/v1/models/_account.json.jbuilder b/app/views/api/v1/models/_account.json.jbuilder
index 9f89a5510..a270f0c9b 100644
--- a/app/views/api/v1/models/_account.json.jbuilder
+++ b/app/views/api/v1/models/_account.json.jbuilder
@@ -6,6 +6,10 @@ if resource.custom_attributes.present?
json.subscribed_quantity resource.custom_attributes['subscribed_quantity']
json.subscription_status resource.custom_attributes['subscription_status']
json.subscription_ends_on resource.custom_attributes['subscription_ends_on']
+ json.industry resource.custom_attributes['industry'] if resource.custom_attributes['industry'].present?
+ json.company_size resource.custom_attributes['company_size'] if resource.custom_attributes['company_size'].present?
+ json.timezone resource.custom_attributes['timezone'] if resource.custom_attributes['timezone'].present?
+ json.logo resource.custom_attributes['logo'] if resource.custom_attributes['logo'].present?
end
end
json.domain @account.domain
From f9900947dcc9bffe17f5e27f787eaaa9721d5d0f Mon Sep 17 00:00:00 2001
From: Sojan
Date: Wed, 14 Feb 2024 19:55:45 +0530
Subject: [PATCH 4/5] chore: Data needed to store onboarding flow
---
app/controllers/api/v1/accounts/agents_controller.rb | 3 +++
app/controllers/api/v1/accounts_controller.rb | 2 +-
app/views/api/v1/models/_account.json.jbuilder | 1 +
.../app/controllers/enterprise/api/v2/accounts_controller.rb | 3 ++-
4 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/app/controllers/api/v1/accounts/agents_controller.rb b/app/controllers/api/v1/accounts/agents_controller.rb
index 221c96b85..e925d59d5 100644
--- a/app/controllers/api/v1/accounts/agents_controller.rb
+++ b/app/controllers/api/v1/accounts/agents_controller.rb
@@ -49,6 +49,9 @@ class Api::V1::Accounts::AgentsController < Api::V1::Accounts::BaseController
Rails.logger.info "[Agent#bulk_create] ignoring email #{email}, errors: #{e.record.errors}"
end
end
+ # remove onboarding_step key in present in Current account custom attributes
+ Current.account.custom_attributes.delete('onboarding_step')
+ Current.account.save!
head :ok
end
diff --git a/app/controllers/api/v1/accounts_controller.rb b/app/controllers/api/v1/accounts_controller.rb
index 0d4ad36b7..b3c178d2e 100644
--- a/app/controllers/api/v1/accounts_controller.rb
+++ b/app/controllers/api/v1/accounts_controller.rb
@@ -43,7 +43,7 @@ class Api::V1::AccountsController < Api::BaseController
def update
@account.assign_attributes(account_params.slice(:name, :locale, :domain, :support_email, :auto_resolve_duration))
- @account.custom_attributes.merge!(custom_attributes_params)
+ @account.custom_attributes['onboarding_step'] = 'invite_team' if custom_attributes_params[:onboarding_step].present?
@account.save!
end
diff --git a/app/views/api/v1/models/_account.json.jbuilder b/app/views/api/v1/models/_account.json.jbuilder
index a270f0c9b..5e9d9048a 100644
--- a/app/views/api/v1/models/_account.json.jbuilder
+++ b/app/views/api/v1/models/_account.json.jbuilder
@@ -10,6 +10,7 @@ if resource.custom_attributes.present?
json.company_size resource.custom_attributes['company_size'] if resource.custom_attributes['company_size'].present?
json.timezone resource.custom_attributes['timezone'] if resource.custom_attributes['timezone'].present?
json.logo resource.custom_attributes['logo'] if resource.custom_attributes['logo'].present?
+ json.onboarding_step resource.custom_attributes['onboarding_step'] if resource.custom_attributes['onboarding_step'].present?
end
end
json.domain @account.domain
diff --git a/enterprise/app/controllers/enterprise/api/v2/accounts_controller.rb b/enterprise/app/controllers/enterprise/api/v2/accounts_controller.rb
index d0d76c1ae..bdd4ba2a2 100644
--- a/enterprise/app/controllers/enterprise/api/v2/accounts_controller.rb
+++ b/enterprise/app/controllers/enterprise/api/v2/accounts_controller.rb
@@ -28,7 +28,8 @@ module Enterprise::Api::V2::AccountsController
'industry' => data[:industry],
'company_size' => data[:company_size],
'timezone' => data[:timezone],
- 'logo' => data[:logo]
+ 'logo' => data[:logo],
+ 'onboarding_step' => 'account_update'
)
)
end
From 3d841369da7d24921b96c2660c8655179cd837a0 Mon Sep 17 00:00:00 2001
From: Nithin David Thomas <1277421+nithindavid@users.noreply.github.com>
Date: Wed, 14 Feb 2024 19:59:29 +0530
Subject: [PATCH 5/5] Reverting unwanted changes
---
app/builders/account_builder.rb | 6 +++---
app/controllers/api/v1/accounts_controller.rb | 2 ++
app/models/user.rb | 2 ++
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/app/builders/account_builder.rb b/app/builders/account_builder.rb
index 32fb5c44b..f179c6405 100644
--- a/app/builders/account_builder.rb
+++ b/app/builders/account_builder.rb
@@ -2,7 +2,7 @@
class AccountBuilder
include CustomExceptions::Account
- pattr_initialize [:email!, :confirmed, :user, :user_password, :super_admin, :locale]
+ pattr_initialize [:account_name, :email!, :confirmed, :user, :user_full_name, :user_password, :super_admin, :locale]
def perform
if @user.nil?
@@ -49,7 +49,7 @@ class AccountBuilder
end
def create_account
- @account = Account.create!(name: '', locale: I18n.locale)
+ @account = Account.create!(name: account_name, locale: I18n.locale)
Current.account = @account
end
@@ -74,7 +74,7 @@ class AccountBuilder
@user = User.new(email: @email,
password: user_password,
password_confirmation: user_password,
- name: '')
+ name: user_full_name)
@user.type = 'SuperAdmin' if @super_admin
@user.confirm if @confirmed
@user.save!
diff --git a/app/controllers/api/v1/accounts_controller.rb b/app/controllers/api/v1/accounts_controller.rb
index b3c178d2e..9ce6641fe 100644
--- a/app/controllers/api/v1/accounts_controller.rb
+++ b/app/controllers/api/v1/accounts_controller.rb
@@ -23,6 +23,8 @@ class Api::V1::AccountsController < Api::BaseController
def create
@user, @account = AccountBuilder.new(
+ account_name: account_params[:account_name],
+ user_full_name: account_params[:user_full_name],
email: account_params[:email],
user_password: account_params[:password],
locale: account_params[:locale],
diff --git a/app/models/user.rb b/app/models/user.rb
index a8467aafc..ba638f637 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -68,6 +68,8 @@ class User < ApplicationRecord
# work because :validatable in devise overrides this.
# validates_uniqueness_of :email, scope: :account_id
+ validates :email, presence: true
+
has_many :account_users, dependent: :destroy_async
has_many :accounts, through: :account_users
accepts_nested_attributes_for :account_users