1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/snserver_ynh.git synced 2024-09-03 20:26:22 +02:00
snserver_ynh/sources/patches/app-01-add-mail.patch
2021-02-10 19:50:36 +01:00

49 lines
1.9 KiB
Diff

diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb
index a813bad..b7f2e2f 100644
--- a/app/mailers/application_mailer.rb
+++ b/app/mailers/application_mailer.rb
@@ -1,4 +1,4 @@
class ApplicationMailer < ActionMailer::Base
- default from: 'Standard Notes <help@standardnotes.org>'
+ default from: 'Standard Notes <__MAIL__>'
layout 'mailer'
end
diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb
index 6bbbb11..ac7f55e 100644
--- a/app/mailers/user_mailer.rb
+++ b/app/mailers/user_mailer.rb
@@ -25,4 +25,9 @@ class UserMailer < ApplicationMailer
user = User.find(user_id)
mail(to: user.email, subject: 'Two-factor authentication has been disabled for your account.')
end
+
+ def welcome(user)
+ @email = user.email
+ mail(to: @email, subject: 'Welcome to your private notes account')
+ end
end
diff --git a/config/application.rb b/config/application.rb
index 3c749e2..feff27c 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -79,7 +79,7 @@ module SyncingServer
:user_name => ENV['SMTP_USERNAME'],
:password => ENV['SMTP_PASSWORD'],
:authentication => 'login',
- :enable_starttls_auto => true # detects and uses STARTTLS
+ :enable_starttls_auto => ENV['SMTP_STARTTLS'].present? # detects and uses STARTTLS
}
# Custom configuration
diff --git a/lib/sync_engine/abstract/user_manager.rb b/lib/sync_engine/abstract/user_manager.rb
index 26a549a..af92835 100644
--- a/lib/sync_engine/abstract/user_manager.rb
+++ b/lib/sync_engine/abstract/user_manager.rb
@@ -29,6 +29,7 @@ module SyncEngine
else
user = @user_class.new(email: email, encrypted_password: hash_password(password))
user.update!(registration_params(params))
+ UserMailer.welcome(user).deliver_later
return success_auth_response(user, params)
end
end