Skip to content

Commit

Permalink
Load enable_starttls_auto as a boolean (#2049)
Browse files Browse the repository at this point in the history
* Correctly load enable_starttls_auto

* flash -> flash.now when rendering directly

* flash.now when admin_created
  • Loading branch information
damianhxy authored Jan 20, 2024
1 parent 306ebe5 commit ea2acb1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def authorize_user_for_course

when :admin_created
@cud = cud
flash[:notice] = "Administrator user added to course"
flash.now[:notice] = "Administrator user added to course"

when :admin_creation_error
flash[:error] = "Error adding administrator #{current_user.email} to course"
Expand Down
8 changes: 4 additions & 4 deletions app/controllers/courses_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def create
rescue StandardError => e
# roll back course creation
@newCourse.destroy
flash[:error] = "Can't create instructor for the course: #{e}"
flash.now[:error] = "Can't create instructor for the course: #{e}"
render(action: "new") && return
end

Expand All @@ -143,7 +143,7 @@ def create
# roll back course creation and instruction creation
new_cud.destroy
@newCourse.destroy
flash[:error] = "Can't load course config for #{@newCourse.name}."
flash.now[:error] = "Can't load course config for #{@newCourse.name}."
render(action: "new") && return
else
flash[:success] = "New Course #{@newCourse.name} successfully created!"
Expand All @@ -152,12 +152,12 @@ def create
else
# roll back course creation
@newCourse.destroy
flash[:error] = "Can't create instructor for the course."
flash.now[:error] = "Can't create instructor for the course."
render(action: "new") && return
end

else
flash[:error] = "Course creation failed. Check all fields"
flash.now[:error] = "Course creation failed. Check all fields"
render(action: "new") && return
end
end
Expand Down
2 changes: 1 addition & 1 deletion config/environments/production.rb.template
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Autolab3::Application.configure do
config.action_mailer.smtp_settings = {
address: ENV.fetch('SMTP_SETTINGS_ADDRESS','smtp.example.com'),
port: ENV.fetch('SMTP_SETTINGS_PORT',25),
enable_starttls_auto: ENV.fetch('SMTP_SETTINGS_ENABLE_STARTTLS_AUTO',true),
enable_starttls_auto: ENV.fetch('SMTP_SETTINGS_ENABLE_STARTTLS_AUTO','true') == 'true',
authentication: ENV.fetch('SMTP_SETTINGS_AUTHENTICATION','login'),
user_name: ENV.fetch('SMTP_SETTINGS_USER_NAME','example'),
password: ENV.fetch('SMTP_SETTINGS_PASSWORD','example'),
Expand Down

0 comments on commit ea2acb1

Please sign in to comment.