Skip to content

Commit

Permalink
added phone number assigned from mobile id auth and remove role from …
Browse files Browse the repository at this point in the history
…profile form
  • Loading branch information
OlegPhenomenon committed Mar 15, 2024
1 parent 883b5de commit 5ced35b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
10 changes: 10 additions & 0 deletions app/controllers/registrant/domains_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ def edit; end
def create
# TODO: Need to add validation for ident of contacts, email and other attributes

unless DomainPrice.all.any?
flash.now[:alert] = t('.no_domain_prices')

render turbo_stream: [
turbo_stream.append('flash', partial: 'layouts/flash')
]

return
end

domain_price = DomainPrice.find(domain_params[:domain_price])

pending = PendingAction.create(
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/registrant/profiles_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def update

def user_params
params.require(:user).permit(
:name, :email, :phone, :phone_code, :ident, :role, :country_code,
:name, :email, :phone, :phone_code, :ident, :country_code,
:city, :street, :zip, :state, :legal_document, :code
)
end
Expand Down
2 changes: 2 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ def self.from_omniauth(tara_params)
user = User.find_or_initialize_by(ident:)
user.name = full_name
user.ident = ident
user.role = User.roles[:priv]
user.phone = tara_params.dig('info', 'phone_number') if user.phone.blank?

user
end
Expand Down
7 changes: 0 additions & 7 deletions app/views/registrant/profiles/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
<%= component 'form/text_input', form: form, attribute: :ident, heroicon_name: 'identification', placeholder: '2323232323', options: { readonly: true } %>
</div>

<div class='w-96'>
<%= component 'form/dropdown_input', form: form, attribute: :role, enum: User.human_enum_options(:role), heroicon_name: 'user-circle' %>
</div>

<div class='w-96'>
<%= component 'form/text_input', form: form, attribute: :code, heroicon_name: 'identification', placeholder: 'ABC:123', options: { readonly: true } %>
</div>
Expand All @@ -22,9 +18,6 @@
</div>

<div class='w-96'>
<%#= component 'form/text_input', form: form, attribute: :phone_code, heroicon_name: 'phone', placeholder: '+372' %>
<%#= component 'form/text_input', form: form, attribute: :phone, heroicon_name: 'phone', placeholder: '56722123' %>

<%= component 'form/phone_input', form: form, phone_attribute: :phone, code_attribute: :phone_code,
code_placeholder: '372', phone_placeholder: '56722123' %>
</div>
Expand Down

0 comments on commit 5ced35b

Please sign in to comment.