From c247fd9d5935ed69d8e43a8ad71ec81226e26e63 Mon Sep 17 00:00:00 2001 From: Syphax bouazzouni Date: Sat, 21 Oct 2023 11:00:17 +0200 Subject: [PATCH 1/2] disable edit link in the submissions table --- app/views/submissions/_submissions.html.haml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/submissions/_submissions.html.haml b/app/views/submissions/_submissions.html.haml index bee3bea66..827862902 100644 --- a/app/views/submissions/_submissions.html.haml +++ b/app/views/submissions/_submissions.html.haml @@ -48,9 +48,9 @@ - if @ontology.admin?(session[:user]) %td %div.d-flex - %a.btn.btn-sm.btn-link{:href => "/ontologies/#{@ontology.acronym}/submissions/#{sub.submissionId}/edit", 'data-turbo-frame':"_top"} - %span Edit - - unless index.zero? + -#%a.btn.btn-sm.btn-link{:href => "/ontologies/#{@ontology.acronym}/submissions/#{sub.submissionId}/edit", 'data-turbo-frame':"_top"} + -# %span Edit + - unless sub.submissionId.eql?(submission_readyId) - alert_text = "Are you sure you want to delete submission " + sub.submissionId.to_s + " for ontology " + @ontology.acronym + "?
This action CAN NOT be undone!!!" = button_to "Delete", "/admin/ontologies/#{@ontology.acronym}/submissions/#{sub.submissionId}?turbo_stream=true", method: :delete, class:'btn btn-sm btn-link', form: {data: { turbo: true, turbo_confirm: alert_text, turbo_frame: '_top'}} From 745e9630feb486343a4454f62807def4440fde4f Mon Sep 17 00:00:00 2001 From: Syphax bouazzouni Date: Sat, 21 Oct 2023 12:31:52 +0200 Subject: [PATCH 2/2] fix user edit action returning always password empty error --- app/controllers/users_controller.rb | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 5c325814a..288b352f3 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,5 +1,5 @@ class UsersController < ApplicationController - + before_action :unescape_id, only: [:edit, :show, :update] before_action :verify_owner, only: [:edit, :show, :subscribe, :un_subscribe] before_action :authorize_admin, only: [:index,:subscribe, :un_subscribe] @@ -231,7 +231,7 @@ def validate(params) end if params[:username].nil? || params[:username].length < 1 || !params[:username].match(/^[a-zA-Z0-9]([._-](?![._-])|[a-zA-Z0-9]){3,18}[a-zA-Z0-9]$/) - errors << "Please provide a valid username, which should not be your email address or include any special characters" + errors << "please enter a valid username" end return errors end @@ -250,16 +250,10 @@ def validate_update(params) if params[:username].nil? || params[:username].length < 1 errors << "Last name field is required" end - if params[:orcidId] && ((!params[:orcidId].match(/^\d{4}+(-\d{4})+$/)) || (params[:orcidId].length != 19)) && !(params[:orcidId].nil? || params[:orcidId].length < 1) - errors << "Please enter a valid orcid id" - end - - - if params[:password].nil? || params[:password].empty? - errors << "Your Password can't be empty" + if params[:orcidId].present? && ((!params[:orcidId].match(/^\d{4}-\d{4}-\d{4}-\d{4}$/)) || (params[:orcidId].length != 19)) + errors << "Please enter a valide orcide id" end - - if params[:password] && !params[:password].eql?(params[:password_confirmation]) + if !params[:password].eql?(params[:password_confirmation]) errors << "Your Password and Password Confirmation do not match" end