Skip to content

Commit

Permalink
Merge pull request DMPRoadmap#2871 from DMPRoadmap/bug_org_select_fixes
Browse files Browse the repository at this point in the history
Org select fixes
  • Loading branch information
briri authored Apr 15, 2021
2 parents 8ee3639 + b91ca63 commit b452aa0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion app/controllers/registrations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ def needs_password?(user)

# rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Layout/LineLength, Metrics/BlockNesting
def do_update(require_password = true, confirm = false)
restrict_orgs = Rails.configuration.x.application.restrict_orgs
mandatory_params = true
# added to by below, overwritten otherwise
message = _("Save Unsuccessful. ")
Expand All @@ -171,7 +172,7 @@ def do_update(require_password = true, confirm = false)
message += _("Please enter a Last name. ")
mandatory_params &&= false
end
if update_params[:org_id].blank?
if restrict_orgs && update_params[:org_id]["id"].blank?
message += _("Please select an organisation from the list, or enter your organisation's name.")
mandatory_params &&= false
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/users/invitations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def fix_org_params
hash = org_hash_from_params(params_in: params[:user])
org = OrgSelection::HashToOrgService.to_org(hash: hash,
allow_create: false)
params[:user][:org_id] = org.id
params[:user][:org_id] = org&.id
end

# Override require_no_authentication method defined at DeviseController
Expand Down
4 changes: 2 additions & 2 deletions app/views/devise/registrations/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
</p>
<div id="create-account-form">
<p >
<%= render partial: 'shared/create_account_form' %>
<%= render partial: 'shared/create_account_form', locals: {orgs: @all_orgs, org_partial: @org_partial} %>
<br>
</p>
</div>
Expand All @@ -59,7 +59,7 @@
<i class="fas fa-user-plus" aria-hidden="true">&nbsp;&nbsp;</i>
</h2>
<div id="create-account-form">
<%= render partial: 'shared/create_account_form' %>
<%= render partial: 'shared/create_account_form', locals: {orgs: @all_orgs, org_partial: @org_partial} %>
</div>
</div>
<% end %>
Expand Down

0 comments on commit b452aa0

Please sign in to comment.