Skip to content

Commit

Permalink
Add security check to account creation
Browse files Browse the repository at this point in the history
  • Loading branch information
lagoan committed Apr 6, 2021
1 parent 2cdfef2 commit 2a0c973
Show file tree
Hide file tree
Showing 12 changed files with 202 additions and 153 deletions.
6 changes: 5 additions & 1 deletion app/controllers/template_options_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ def index
.organisationally_visible
.where(org_id: org_id, customization_of: nil).to_a
end

# Include customizable funder templates
@templates << funder_templates = Template.latest_customizable

@templates = @templates.flatten.uniq
end

Expand All @@ -53,7 +57,7 @@ def index

@templates << (customization.present? ? customization : Template.default)
end
@templates = @templates.sort_by(&:title)
@templates = @templates.uniq.sort_by(&:title)
end

private
Expand Down
6 changes: 4 additions & 2 deletions app/models/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,14 @@ class Template < ActiveRecord::Base
# default template)
scope :latest_customizable, lambda {
funder_ids = Org.funder.pluck(:id)
# Make sure we include the default template

family_ids = families(funder_ids).distinct
.pluck(:family_id) + [default.family_id]

published(family_ids.uniq)
.where("visibility = :visibility OR is_default = :is_default",
visibility: visibilities[:publicly_visible], is_default: true)
.where("visibility = :visibility",
visibility: visibilities[:publicly_visible])
}

# Retrieves unarchived templates with public visibility
Expand Down
2 changes: 1 addition & 1 deletion app/views/org_admin/templates/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<%= f.text_area(:description, class: "template") %>
</div>

<% if current_user.org.funder? && !current_user.org.funder_only? %>
<% if current_user.org.funder? %>
<!-- If the Org is a funder and another org type then allow then to set the visibility -->
<div class="form-group col-xs-8">
<%= f.label _('Visibility'), class: 'control-label' %>
Expand Down
120 changes: 60 additions & 60 deletions config/locale/app.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ msgid ""
msgstr ""
"Project-Id-Version: roadmap 1.0\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2021-03-18 11:30-0600\n"
"PO-Revision-Date: 2021-03-18 11:30-0600\n"
"POT-Creation-Date: 2021-03-22 12:24-0600\n"
"PO-Revision-Date: 2021-03-22 12:24-0600\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"Language: \n"
Expand Down Expand Up @@ -2821,7 +2821,7 @@ msgstr ""

#: ../../app/views/org_admin/phases/_phase.html.erb:37
#: ../../app/views/org_admin/questions/_index.html.erb:1
#: ../../tmp/translation/database_strings.rb:125
#: ../../tmp/translation/database_strings.rb:135
msgid "Questions"
msgstr ""

Expand Down Expand Up @@ -5512,7 +5512,7 @@ msgid "DEFAULT TITLE"
msgstr ""

#: ../../tmp/translation/database_strings.rb:61
#: ../../tmp/translation/database_strings.rb:137
#: ../../tmp/translation/database_strings.rb:113
msgid "Template for Qualitative Health Sciences Research"
msgstr ""

Expand All @@ -5521,12 +5521,12 @@ msgid "Template for Interdisciplinary Health Software/Technology Development"
msgstr ""

#: ../../tmp/translation/database_strings.rb:63
#: ../../tmp/translation/database_strings.rb:139
#: ../../tmp/translation/database_strings.rb:115
msgid "Template for Arts-Based Research"
msgstr ""

#: ../../tmp/translation/database_strings.rb:64
#: ../../tmp/translation/database_strings.rb:140
#: ../../tmp/translation/database_strings.rb:116
msgid "Template for Mixed Methods (Surveys & Qualitative Research)"
msgstr ""

Expand All @@ -5539,32 +5539,32 @@ msgid "Template for Research in History and the Humanities"
msgstr ""

#: ../../tmp/translation/database_strings.rb:67
#: ../../tmp/translation/database_strings.rb:112
#: ../../tmp/translation/database_strings.rb:123
msgid "CRDCN Template for Accessing Data from Research Data Centres"
msgstr ""

#: ../../tmp/translation/database_strings.rb:68
#: ../../tmp/translation/database_strings.rb:114
#: ../../tmp/translation/database_strings.rb:126
msgid "CRDCN Template for Research Data Centres and External Analysis"
msgstr ""

#: ../../tmp/translation/database_strings.rb:69
#: ../../tmp/translation/database_strings.rb:116
#: ../../tmp/translation/database_strings.rb:128
msgid "Template for Water Quality Research"
msgstr ""

#: ../../tmp/translation/database_strings.rb:70
#: ../../tmp/translation/database_strings.rb:118
#: ../../tmp/translation/database_strings.rb:130
msgid "Template for Systematic Reviews"
msgstr ""

#: ../../tmp/translation/database_strings.rb:71
#: ../../tmp/translation/database_strings.rb:120
#: ../../tmp/translation/database_strings.rb:132
msgid "Template for Studying Molecular Interactions"
msgstr ""

#: ../../tmp/translation/database_strings.rb:72
#: ../../tmp/translation/database_strings.rb:122
#: ../../tmp/translation/database_strings.rb:134
msgid "Template for Open Science Workflows"
msgstr ""

Expand Down Expand Up @@ -5917,128 +5917,128 @@ msgid ""
msgstr ""

#: ../../tmp/translation/database_strings.rb:108
msgid "MICYRN Data Management Plan Initial Phase"
#: ../../tmp/translation/database_strings.rb:233
msgid "TITLE"
msgstr ""

#: ../../tmp/translation/database_strings.rb:109
msgid "Phase 1: Data Management Plan for Grant Application"
msgid "Alliance/Food from Thought DMP creation"
msgstr ""

#: ../../tmp/translation/database_strings.rb:110
msgid "Reproducible findings through deposited data"
msgid "Test DMP Questions"
msgstr ""

#: ../../tmp/translation/database_strings.rb:111
msgid "University of British Columbia Data Management Questions"
msgid "Phase 1 (test)"
msgstr ""

#: ../../tmp/translation/database_strings.rb:113
msgid "Portage Data Management Questions"
#: ../../tmp/translation/database_strings.rb:112
msgid "Initial GWF DMP"
msgstr ""

#: ../../tmp/translation/database_strings.rb:115
msgid "Pre-Project: Prototype"
#: ../../tmp/translation/database_strings.rb:114
msgid "Software/Technology Management Plan"
msgstr ""

#: ../../tmp/translation/database_strings.rb:117
msgid "CEOS Data Management Plan"
msgid "Phase 1: Data Preparation"
msgstr ""

#: ../../tmp/translation/database_strings.rb:118
msgid "University of Alberta Data Management Questions"
msgstr ""

#: ../../tmp/translation/database_strings.rb:119
msgid "Oceans Data Management Plan"
msgid "MICYRN Data Management Plan Initial Phase"
msgstr ""

#: ../../tmp/translation/database_strings.rb:120
msgid "Phase 1: Data Management Plan for Grant Application"
msgstr ""

#: ../../tmp/translation/database_strings.rb:121
msgid "University of Manitoba Data Management Questions"
msgid "Reproducible findings through deposited data"
msgstr ""

#: ../../tmp/translation/database_strings.rb:123
msgid "DMP Questionnaire"
#: ../../tmp/translation/database_strings.rb:122
msgid "University of British Columbia Data Management Questions"
msgstr ""

#: ../../tmp/translation/database_strings.rb:124
msgid "Phase 1"
msgid "Portage Data Management Questions"
msgstr ""

#: ../../tmp/translation/database_strings.rb:126
msgid "University of Guelph Agri-Food Funding DMP (Alliance/Food from Thought) "
#: ../../tmp/translation/database_strings.rb:125
msgid "Pre-Project: Prototype"
msgstr ""

#: ../../tmp/translation/database_strings.rb:127
msgid "Data management questions"
msgstr ""

#: ../../tmp/translation/database_strings.rb:128
msgid "York U Data Management Questions"
msgid "CEOS Data Management Plan"
msgstr ""

#: ../../tmp/translation/database_strings.rb:129
msgid "MUN Data Management Questions"
msgstr ""

#: ../../tmp/translation/database_strings.rb:130
msgid "OFI Module E DMP"
msgid "Oceans Data Management Plan"
msgstr ""

#: ../../tmp/translation/database_strings.rb:131
msgid "Dalhousie University"
msgid "University of Manitoba Data Management Questions"
msgstr ""

#: ../../tmp/translation/database_strings.rb:132
#: ../../tmp/translation/database_strings.rb:233
msgid "TITLE"
#: ../../tmp/translation/database_strings.rb:133
msgid "DMP Questionnaire"
msgstr ""

#: ../../tmp/translation/database_strings.rb:133
msgid "Alliance/Food from Thought DMP creation"
#: ../../tmp/translation/database_strings.rb:136
msgid "Phase 1"
msgstr ""

#: ../../tmp/translation/database_strings.rb:134
msgid "Test DMP Questions"
#: ../../tmp/translation/database_strings.rb:137
msgid "University of Guelph Agri-Food Funding DMP (Alliance/Food from Thought) "
msgstr ""

#: ../../tmp/translation/database_strings.rb:135
msgid "Phase 1 (test)"
#: ../../tmp/translation/database_strings.rb:138
msgid "Data management questions"
msgstr ""

#: ../../tmp/translation/database_strings.rb:136
msgid "Initial GWF DMP"
#: ../../tmp/translation/database_strings.rb:139
msgid "York U Data Management Questions"
msgstr ""

#: ../../tmp/translation/database_strings.rb:138
msgid "Software/Technology Management Plan"
#: ../../tmp/translation/database_strings.rb:140
msgid "MUN Data Management Questions"
msgstr ""

#: ../../tmp/translation/database_strings.rb:141
msgid "Phase 1: Data Preparation"
msgid "OFI Module E DMP"
msgstr ""

#: ../../tmp/translation/database_strings.rb:142
msgid "University of Alberta Data Management Questions"
msgid "Dalhousie University"
msgstr ""

#: ../../tmp/translation/database_strings.rb:143
msgid "Phase 2: Data Management Plan for Project Development"
msgid "Phase 2"
msgstr ""

#: ../../tmp/translation/database_strings.rb:144
msgid "Phase 2"
msgid "Export"
msgstr ""

#: ../../tmp/translation/database_strings.rb:145
msgid "Export"
msgid "OMAFRA-UG DMP Questions"
msgstr ""

#: ../../tmp/translation/database_strings.rb:146
msgid "OMAFRA-UG DMP Questions"
msgid "Data Management Plan"
msgstr ""

#: ../../tmp/translation/database_strings.rb:147
msgid "Data Management Plan"
msgid "Phase 2: Active Research (Data) Management"
msgstr ""

#: ../../tmp/translation/database_strings.rb:148
msgid "Phase 2: Active Research (Data) Management"
msgid "Phase 2: Data Management Plan for Project Development"
msgstr ""

#: ../../tmp/translation/database_strings.rb:149
Expand Down
Binary file modified config/locale/en_CA/LC_MESSAGES/app.mo
Binary file not shown.
Loading

0 comments on commit 2a0c973

Please sign in to comment.