Skip to content

Commit

Permalink
prevent global only user to reset password aces#1391
Browse files Browse the repository at this point in the history
  • Loading branch information
MontrealSergiy committed May 14, 2024
1 parent e9abfd4 commit 54c1fa5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions BrainPortal/app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,11 @@ def send_password #:nodoc:
@user = User.where( :login => params[:login], :email => params[:email] ).first
if @user
if user_must_link_to_globus?(@user)
cb_error "Your account can only authenticate with Globus identities.", :redirect => user_path(current_user)
contact = RemoteResource.current_resource.support_email.presence || User.admin.email.presence || "the support staff"
wipe_user_password_after_globus_link(@user) # for legacy or erroneously set users
flash[:error] = "You cannot access the portal with password. Thus you cannot reset password.Your account can only authenticate with Globus identities. please write to #{contact} for help"
respond_to do |format|
format.html { redirect_to :controller => :sessions, :action => :mandatory_globus }
format.html { redirect_to login_path }
format.any { head :unauthorized }
end
return
Expand Down

0 comments on commit 54c1fa5

Please sign in to comment.