feat: Add full name to the user signup form (#1534)

This commit is contained in:
Pranav Raj S
2020-12-21 14:05:19 +05:30
committed by GitHub
parent 796e376fa7
commit 9d3dda9a61
10 changed files with 163 additions and 219 deletions

View File

@@ -2,7 +2,7 @@
class AccountBuilder
include CustomExceptions::Account
pattr_initialize [:account_name!, :email!, :confirmed!, :user]
pattr_initialize [:account_name!, :email!, :confirmed!, :user, :user_full_name]
def perform
if @user.nil?
@@ -60,18 +60,13 @@ class AccountBuilder
)
end
def email_to_name(email)
name = email[/[^@]+/]
name.split('.').map(&:capitalize).join(' ')
end
def create_user
password = SecureRandom.alphanumeric(12)
@user = User.new(email: @email,
password: password,
password_confirmation: password,
name: email_to_name(@email))
name: @user_full_name)
@user.confirm if @confirmed
@user.save!
end