Skip to content

Commit

Permalink
add password reset token expiration
Browse files Browse the repository at this point in the history
  • Loading branch information
syphax-bouazzouni committed Oct 25, 2024
1 parent fd91cb8 commit 83109d0
Show file tree
Hide file tree
Showing 11 changed files with 148 additions and 152 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ GIT

GIT
remote: https://github.com/ontoportal-lirmm/ontologies_linked_data.git
revision: c0f8697529ebfca2c3fe90d46d9482ac72f13362
revision: 5ff72652042e7828af670eac7071b2a4411f7d74
branch: development
specs:
ontologies_linked_data (0.0.1)
Expand Down
9 changes: 2 additions & 7 deletions helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def month_param(params=nil)
if params["month"]
month = params["month"].strip
if %r{(?<month>^(0[1-9]|[1-9]|1[0-2])$)}x === month
month.to_i.to_s
return month.to_i.to_s
end
end
nil
Expand All @@ -288,7 +288,7 @@ def year_param(params=nil)
if params["year"]
year = params["year"].strip
if %r{(?<year>^([1-2]\d{3})$)}x === year
year.to_i.to_s
return year.to_i.to_s
end
end
nil
Expand Down Expand Up @@ -401,11 +401,6 @@ def get_ontology_and_submission
if !submission.ready?(status: [:RDF])
error 404, "Ontology #{@params["ontology"]} submission #{submission.submissionId} has not been parsed."
end
if submission.nil?
if submission.nil?
error 404, "Ontology #{@params["acronym"]} does not have any submissions"
end
end

save_submission_language(submission)

Expand Down
4 changes: 3 additions & 1 deletion helpers/submission_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ def retrieve_submissions(options)
submissions_query = submissions_query.where({ submissionStatus: [code: status] })
end

submissions_query = submissions_query.order_by(order_by) unless order_by.nil?

submissions_query = apply_submission_filters(submissions_query)
submissions_query = submissions_query.filter(Goo::Filter.new(ontology: [:viewOf]).unbound) unless include_views
submissions_query = submissions_query.filter(filter) if filter?
Expand All @@ -72,4 +74,4 @@ def include_ready?(options)
end
end

helpers Sinatra::Helpers::SubmissionHelper
helpers Sinatra::Helpers::SubmissionHelper
4 changes: 2 additions & 2 deletions test/controllers/test_collections_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class TestCollectionsController < TestCase

def self.before_suite
def before_suite
LinkedData::SampleData::Ontology.create_ontologies_and_submissions({
process_submission: true,
process_options: {process_rdf: true, extract_metadata: false},
Expand All @@ -19,7 +19,7 @@ def self.before_suite
sub.save
end

def self.after_suite
def after_suite
LinkedData::SampleData::Ontology.delete_ontologies_and_submissions
end

Expand Down
4 changes: 2 additions & 2 deletions test/controllers/test_dereference_resource_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class TestDereferenceResourceController < TestCase

def self.before_suite
def before_suite
LinkedData::SampleData::Ontology.create_ontologies_and_submissions({
process_submission: true,
process_options: { process_rdf: true, extract_metadata: false, generate_missing_labels: false},
Expand Down Expand Up @@ -192,4 +192,4 @@ def sort_nested_hash(hash)
sorted_hash.sort.to_h
end

end
end
3 changes: 1 addition & 2 deletions test/controllers/test_external_mappings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class TestExternalMappingsController < TestCase

def self.before_suite
def before_suite
["BRO-TEST-MAP-0", "CNO-TEST-MAP-0", "FAKE-TEST-MAP-0"].each do |acr|
LinkedData::Models::OntologySubmission.where(ontology: [acronym: acr]).to_a.each do |s|
s.delete
Expand Down Expand Up @@ -147,4 +147,3 @@ def delete_interportal_mappings
end

end

258 changes: 129 additions & 129 deletions test/controllers/test_ontology_analytics_controller.rb

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions test/controllers/test_ontology_submissions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def test_ontology_submissions_access_controller
allowed_user.save
blocked_user = User.new({
username: "blocked",
email: "test@example.org",
email: "test1254@example.org",
password: "12345"
})
blocked_user.save
Expand Down Expand Up @@ -374,7 +374,7 @@ def test_submissions_pagination_filter
assert last_response.ok?
submissions = MultiJson.load(last_response.body)
refute_empty submissions["collection"]
assert_equal ontologies.map{|x| x.latest_submission(status: :any).bring(:creationDate).creationDate}.sort.map(&:to_s), submissions["collection"].map{|x| x["creationDate"]}.reverse
assert_equal ontologies.map{|x| x.latest_submission(status: :any).bring(:creationDate).creationDate}.sort, submissions["collection"].map{|x| DateTime.parse(x["creationDate"])}.reverse

# test search with format
get "/submissions?page=1&pagesize=100&acronym=tes&name=tes&hasOntologyLanguage=SKOS"
Expand Down
4 changes: 2 additions & 2 deletions test/controllers/test_schemes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class TestSchemesController < TestCase

def self.before_suite
def before_suite
LinkedData::SampleData::Ontology.create_ontologies_and_submissions({
process_submission: true,
acronym: 'INRAETHES',
Expand All @@ -13,7 +13,7 @@ def self.before_suite
})
end

def self.after_suite
def after_suite
LinkedData::SampleData::Ontology.delete_ontologies_and_submissions
end

Expand Down
4 changes: 2 additions & 2 deletions test/controllers/test_search_models_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class TestSearchModelsController < TestCase

def self.after_suite
def after_suite
LinkedData::SampleData::Ontology.delete_ontologies_and_submissions
LinkedData::Models::Ontology.indexClear
LinkedData::Models::Agent.indexClear
Expand All @@ -12,7 +12,7 @@ def self.after_suite
end

def setup
self.class.after_suite
after_suite
end

def test_show_all_collection
Expand Down
4 changes: 2 additions & 2 deletions test/controllers/test_skos_xl_label_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class TestSkosXlLabelController < TestCase

def self.before_suite
def before_suite
LinkedData::SampleData::Ontology.create_ontologies_and_submissions({
process_submission: true,
acronym: 'INRAETHES',
Expand All @@ -18,7 +18,7 @@ def self.before_suite
sub.save
end

def self.after_suite
def after_suite
LinkedData::SampleData::Ontology.delete_ontologies_and_submissions
end

Expand Down

0 comments on commit 83109d0

Please sign in to comment.