1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/snserver_ynh.git synced 2024-09-03 20:26:22 +02:00

Add registration mail

This commit is contained in:
Fabian Wilkens 2021-02-06 01:44:31 +01:00
parent e6ba4d20b0
commit 8481641ba0
No known key found for this signature in database
GPG key ID: 23DFA025BB4E9FAB
4 changed files with 296 additions and 0 deletions

View file

@ -119,6 +119,17 @@ ynh_script_progression --message="Modifying a config file..." --weight=1
config_file="$final_path/live/.env"
ynh_replace_string --match_string="RAILS_RELATIVE_URL_ROOT=$old_path" --replace_string="RAILS_RELATIVE_URL_ROOT=$new_path" --target_file="$config_file"
if [ $change_domain -eq 1 ]
then
mail_new="$app@$domain_new"
ynh_replace_string --match_string="$mail" --replace_string="$mail_new" --target_file="$final_path/live/app/mailers/application_mailer.rb"
ynh_replace_string --match_string="$domain" --replace_string="$domain_new" --target_file="$final_path/live/app/views/user_mailer/welcome.html.erb"
fi
if [ $change_path -eq 1 ]
then
ynh_replace_string --match_string="$path_url" --replace_string="$path_new" --target_file="$final_path/live/app/views/user_mailer/welcome.html.erb"
fi
#=================================================
# Modify Standard Notes - Extensions
#=================================================

View file

@ -39,6 +39,7 @@ else
access_domain=$domain
fi
fi
mail=$app$domain
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
@ -59,6 +60,7 @@ ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
ynh_app_setting_set --app=$app --key=install_extensions --value=$install_extensions
ynh_app_setting_set --app=$app --key=access_domain --value=$access_domain
ynh_app_setting_set --app=$app --key=mail --value=$mail
#=================================================
# STANDARD MODIFICATIONS
@ -148,6 +150,13 @@ ynh_replace_string --match_string="DB_DATABASE=standard_notes_db" --replace_stri
ynh_replace_string --match_string="DB_USERNAME=std_notes_user" --replace_string="DB_USERNAME=$db_user" --target_file="$config_file"
ynh_replace_string --match_string="DB_PASSWORD=changeme123" --replace_string="DB_PASSWORD=$db_pwd" --target_file="$config_file"
ynh_replace_string --match_string="RAILS_RELATIVE_URL_ROOT=/" --replace_string="RAILS_RELATIVE_URL_ROOT=$path_url" --target_file="$config_file"
ynh_replace_string --match_string="SMTP_HOST=.*$" --replace_string="SMTP_HOST=localhost" --target_file="$config_file"
ynh_replace_string --match_string="SMTP_PORT=.*$" --replace_string="SMTP_PORT=25" --target_file="$config_file"
ynh_replace_string --match_string="SMTP_DOMAIN=.*$" --replace_string="SMTP_DOAMIN=localhost" --target_file="$config_file"
ynh_replace_string --match_string="__MAIL__" --replace_string="$mail" --target_file="$final_path/live/app/mailers/application_mailer.rb"
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/live/app/views/user_mailer/welcome.html.erb"
ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="$final_path/live/app/views/user_mailer/welcome.html.erb"
#=================================================
# INSTALLING Standard Notes - Synicing Server

View file

@ -27,6 +27,7 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
port=$(ynh_app_setting_get --app=$app --key=port)
install_extensions=$(ynh_app_setting_get --app=$app --key=install_extensions)
access_domain=$(ynh_app_setting_get --app=$app --key=access_domain)
mail=$(ynh_app_setting_get --app=$app --key=mail)
#=================================================
# CHECK VERSION
@ -187,6 +188,13 @@ ynh_replace_string --match_string="DB_DATABASE=standard_notes_db" --replace_stri
ynh_replace_string --match_string="DB_USERNAME=std_notes_user" --replace_string="DB_USERNAME=$db_user" --target_file="$config_file"
ynh_replace_string --match_string="DB_PASSWORD=changeme123" --replace_string="DB_PASSWORD=$db_pwd" --target_file="$config_file"
ynh_replace_string --match_string="RAILS_RELATIVE_URL_ROOT=/" --replace_string="RAILS_RELATIVE_URL_ROOT=$path_url" --target_file="$config_file"
ynh_replace_string --match_string="SMTP_HOST=$" --replace_string="SMTP_HOST=localhost" --target_file="$config_file"
ynh_replace_string --match_string="SMTP_PORT=$" --replace_string="SMTP_PORT=25" --target_file="$config_file"
ynh_replace_string --match_string="SMTP_DOMAIN=$" --replace_string="SMTP_DOAMIN=localhost" --target_file="$config_file"
ynh_replace_string --match_string="__MAIL__" --replace_string="$mail" --target_file="$final_path/live/app/mailers/application_mailer.rb"
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/live/app/views/user_mailer/welcome.html.erb"
ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="$final_path/live/app/views/user_mailer/welcome.html.erb"
#=================================================
# INSTALLING Standard Notes - Synicing Server

View file

@ -0,0 +1,268 @@
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/app/views/user_mailer/welcome.html.erb b/app/views/user_mailer/welcome.html.erb
new file mode 100644
index 0000000..fa4ba56
--- /dev/null
+++ b/app/views/user_mailer/welcome.html.erb
@@ -0,0 +1,226 @@
+<!DOCTYPE html>
+<html style="font-family: sans-serif; line-height: 1.3 !important; font-size: 18px; color: black !important; box-sizing: border-box; margin: 0; padding: 0;">
+ <head>
+ <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
+<style>
+.sn-component .sk-panel a:hover {
+text-decoration: underline;
+}
+.sn-component .sk-menu-panel .row:hover {
+background-color: #efefef;
+}
+.sn-component .sk-menu-panel .row .column .row:hover,
+.sn-component .sk-menu-panel .row .column .subrow:hover {
+background-color: #f7f7f7;
+}
+.sn-component .sk-button.default:hover,
+.sn-component .default.sk-box:hover,
+.sn-component .default.sk-circle:hover,
+.sn-component .sk-box.default:hover,
+.sn-component .sk-circle.default:hover {
+background-color: white; color: #939393;
+}
+.sn-component .sk-button.default.featured:hover,
+.sn-component .default.featured.sk-box:hover,
+.sn-component .default.featured.sk-circle:hover,
+.sn-component .sk-box.default.featured:hover,
+.sn-component .sk-circle.default.featured:hover {
+background-color: #9f9f9f;
+}
+.sn-component .sk-button.info:hover,
+.sn-component .info.sk-box:hover,
+.sn-component .info.sk-circle:hover,
+.sn-component .sk-box.info:hover,
+.sn-component .sk-circle.info:hover {
+background-color: #d5e9fd; color: #0975e5;
+}
+.sn-component .sk-button.info.featured:hover,
+.sn-component .info.featured.sk-box:hover,
+.sn-component .info.featured.sk-circle:hover,
+.sn-component .sk-box.info.featured:hover,
+.sn-component .sk-circle.info.featured:hover {
+background-color: #1181f6;
+}
+.sn-component .sk-button.warning:hover,
+.sn-component .warning.sk-box:hover,
+.sn-component .warning.sk-circle:hover,
+.sn-component .sk-box.warning:hover,
+.sn-component .sk-circle.warning:hover {
+background-color: #fff8ec; color: #ffaa06;
+}
+.sn-component .sk-button.warning.featured:hover,
+.sn-component .warning.featured.sk-box:hover,
+.sn-component .warning.featured.sk-circle:hover,
+.sn-component .sk-box.warning.featured:hover,
+.sn-component .sk-circle.warning.featured:hover {
+background-color: #ffb320;
+}
+.sn-component .sk-button.danger:hover,
+.sn-component .danger.sk-box:hover
+.sn-component .danger.sk-circle:hover,
+.sn-component .sk-box.danger:hover,
+.sn-component .sk-circle.danger:hover {
+background-color: #fff1f3; color: #fc0e2e;
+}
+.sn-component .sk-button.danger.featured:hover,
+.sn-component .danger.featured.sk-box:hover,
+.sn-component .danger.featured.sk-circle:hover,
+.sn-component .sk-box.danger.featured:hover,
+.sn-component .sk-circle.danger.featured:hover {
+background-color: #fc2744;
+}
+.sn-component .sk-button.success:hover,
+.sn-component .success.sk-box:hover,
+.sn-component .success.sk-circle:hover,
+.sn-component .sk-box.success:hover,
+.sn-component .sk-circle.success:hover {
+background-color: #b7f5a8; color: #2fa414;
+}
+.sn-component .sk-button.success.featured:hover,
+.sn-component .success.featured.sk-box:hover,
+.sn-component .success.featured.sk-circle:hover,
+.sn-component .sk-box.success.featured:hover,
+.sn-component .sk-circle.success.featured:hover {
+background-color: #35ba16;
+}
+.sn-component .sk-notification.info.featured:hover {
+background-color: #1181f6;
+}
+.sn-component .sk-notification.warning.featured:hover {
+background-color: #ffb320;
+}
+body {
+font-family: sans-serif; line-height: 1.3 !important; font-size: 18px; color: black !important; margin: 0; padding: 0;
+}
+@media (max-width: 767px) {
+ html {
+ font-size: 17px !important;
+ }
+ body {
+ font-size: 17px !important;
+ }
+ .sn-component .sk-panel .sk-panel-content {
+ padding: 0.5rem 1.1rem !important;
+ }
+ .sn-component .sk-panel .sk-panel-footer {
+ padding: 0.5rem 1.1rem !important;
+ }
+}
+</style>
+</head>
+ <body style="font-family: sans-serif; line-height: 1.3 !important; font-size: 18px; color: black !important; box-sizing: border-box; margin: 0; padding: 0;">
+ <div class="sn-component" style='font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; -webkit-font-smoothing: antialiased; box-sizing: border-box;'>
+ <div class="sk-panel static" style="border-radius: 0; overflow: visible; box-shadow: none; box-sizing: border-box; border: none;">
+ <div class="sk-panel-content" style="overflow: visible; overflow-y: visible !important; overflow-x: visible !important; box-sizing: border-box; padding: 1.6rem 2rem 0;">
+<div class="sk-panel-section" style="padding-bottom: 1.6rem; margin-bottom: 1.5rem; border-bottom-color: #DDDDDD; border-bottom-width: 1px; border-bottom-style: solid; box-sizing: border-box;">
+ <div class="h1 title sk-panel-row" style="justify-content: space-between; align-items: center; padding-top: 0.4rem; padding-bottom: 0.4rem; font-size: 1.5rem !important; box-sizing: border-box;">
+ <div class="sk-panel-column" style="box-sizing: border-box;">
+ Welcome to
+ <strong style="box-sizing: border-box;">Standard Notes.</strong>
+ </div>
+ </div>
+ <div class="faded sk-panel-row small" style="justify-content: space-between; align-items: center; padding-top: 0.4rem; font-size: 14px !important; opacity: 0.5; box-sizing: border-box;">
+ Registered as <%= @email %>
+ </div>
+</div>
+<div class="sk-panel-section" style="padding-bottom: 1.6rem; box-sizing: border-box;">
+ <p style="line-height: 1.3 !important; color: black !important; box-sizing: border-box; margin: 0.5rem 0 20px;">
+ <i style="box-sizing: border-box;">Hi there,</i>
+ </p>
+ <p style="line-height: 1.3 !important; color: black !important; box-sizing: border-box; margin: 0.5rem 0 20px;">
+ Welcome to your new private notes account.
+ We created Standard Notes to be a safe, private, and lasting place for your most important work.
+ </p>
+ <p style="line-height: 1.3 !important; color: black !important; box-sizing: border-box; margin: 0.5rem 0 20px;">
+ <strong style="box-sizing: border-box;">You should know:</strong>
+ </p>
+ <ol style="box-sizing: border-box;">
+ <li style="line-height: 1.3; margin-bottom: 10px; box-sizing: border-box;">
+ Your notes are fully encrypted on your device before they're ever sent to our servers.
+ This means even we can't read the contents of your notes.
+ </li>
+ <li style="line-height: 1.3; margin-bottom: 10px; box-sizing: border-box;">
+ Standard Notes is available on all your devices. Download the
+ <a href="https://itunes.apple.com/us/app/standard-notes/id1285392450?mt=8" style="cursor: pointer; color: #086dd6; box-sizing: border-box; text-decoration: none;">iOS</a>
+ and
+ <a href="https://play.google.com/store/apps/details?id=com.standardnotes" style="cursor: pointer; color: #086dd6; box-sizing: border-box; text-decoration: none;">Android</a>
+ app to go mobile. Use the
+ <a href="https://app.standardnotes.org" style="cursor: pointer; color: #086dd6; box-sizing: border-box; text-decoration: none;">web app</a> on the go. Or download the desktop app on
+ <a href="https://standardnotes.org/download/mac" style="cursor: pointer; color: #086dd6; box-sizing: border-box; text-decoration: none;">Mac</a>, <a href="https://standardnotes.org/download/windows" style="cursor: pointer; color: #086dd6; box-sizing: border-box; text-decoration: none;">Windows</a>, and <a href="https://standardnotes.org/download/linux" style="cursor: pointer; color: #086dd6; box-sizing: border-box; text-decoration: none;">Linux</a>.
+ </li>
+ </ol>
+ <p style="line-height: 1.3 !important; color: black !important; box-sizing: border-box; margin: 0.5rem 0 20px;">
+ <strong style="box-sizing: border-box;">Install instructions for Extensions:</strong>
+ </p>
+ <ol style="box-sizing: border-box;">
+ <li style="line-height: 1.3; margin-bottom: 10px; box-sizing: border-box;">
+ Open the Standard Notes web or Desktop app
+ </li>
+ <li style="line-height: 1.3; margin-bottom: 10px; box-sizing: border-box;">
+ Press <strong>Extensions</strong> in the button left corner
+ </li>
+ <li style="line-height: 1.3; margin-bottom: 10px; box-sizing: border-box;">
+ Press on <strong>Import Extensions</strong> in the button right corner of the new window.
+ </li>
+ <li style="line-height: 1.3; margin-bottom: 10px; box-sizing: border-box;">
+ Enter <strong>https://__DOMAIN____PATH__/extensions/repo.json</strong> in the field.
+ </li>
+ <li style="line-height: 1.3; margin-bottom: 10px; box-sizing: border-box;">
+ Press <strong>Enter</strong> on your keyboard.
+ </li>
+ <li style="line-height: 1.3; margin-bottom: 10px; box-sizing: border-box;">
+ Press on <strong>Install</strong>
+ </li>
+ <li style="line-height: 1.3; margin-bottom: 10px; box-sizing: border-box;">
+ Now you can see Editors, Themes and Components which you can install
+ </li>
+ </ol>
+ <h4 class="sk-panel-row" style="justify-content: space-between; align-items: center; font-weight: bold; font-size: 0.95rem; line-height: 1.4rem; box-sizing: border-box; margin: 0; padding: 0.4rem 0;">To have all Standard Notes extensions use <strong>Standard Notes Extened</strong>:</h4>
+ <div class="sk-panel-row" style="justify-content: space-between; align-items: center; padding-top: 0.4rem; padding-bottom: 0.4rem; box-sizing: border-box;"></div>
+ <div class="horizontal-blocks center extended boxed gray" style="box-sizing: border-box;">
+ <div class="h-block blue-stroke purchase-box" style="width: 100%; box-sizing: border-box; background-color: #f8f8f8; color: black !important; border-radius: 3px !important; margin-right: 40px; margin-bottom: 40px; padding: 15px 30px 30px; border: 1px solid #086dd6;">
+ <p class="box-title" style="line-height: 1.3 !important; color: black !important; box-sizing: border-box; font-size: 26px; margin: 0.5rem 0 20px;">Standard Notes <strong class="extended-text" style="box-sizing: border-box; border-left-style: solid; border-left-color: #086dd6; border-left-width: 3px; padding-left: 10px; margin-left: 5px;">Extended</strong></p>
+ <p style="line-height: 1.3 !important; color: black !important; box-sizing: border-box; margin: 0.5rem 0 20px;">
+ Unlock entirely new workflows with powerful editors and cloud backup options
+ with
+ <a href="https://standardnotes.org/extensions" style="cursor: pointer; color: #086dd6; box-sizing: border-box; text-decoration: none;">Extended.</a>
+ Extended is our paid extensions program, and how we support continued development on Standard Notes.
+ </p>
+ <p style="line-height: 1.3 !important; color: black !important; box-sizing: border-box; margin: 0.5rem 0 20px;">
+ <strong style="box-sizing: border-box;">Benefits:</strong>
+ </p>
+ <ul class="no-bullet" style="list-style-type: none !important; padding-left: 0; margin-left: 0; box-sizing: border-box;">
+ <li style="line-height: 1.3; margin-bottom: 10px; box-sizing: border-box;">
+ <p style="line-height: 1.3 !important; color: black !important; box-sizing: border-box; margin: 0.5rem 0 20px;"><span class="checkmark" style="box-sizing: border-box; color: #086dd6; margin-right: 5px;">&#x2713;</span> Encrypted attachments for your notes stored directly in your Dropbox, Google Drive, or WebDAV.</p>
+ </li>
+ <li style="line-height: 1.3; margin-bottom: 10px; box-sizing: border-box;">
+ <p style="line-height: 1.3 !important; color: black !important; box-sizing: border-box; margin: 0.5rem 0 20px;"><span class="checkmark" style="box-sizing: border-box; color: #086dd6; margin-right: 5px;">&#x2713;</span> Unlimited access to powerful extensions, editors, and beautiful themes.</p>
+ </li>
+ <li style="line-height: 1.3; margin-bottom: 10px; box-sizing: border-box;">
+ <p style="line-height: 1.3 !important; color: black !important; box-sizing: border-box; margin: 0.5rem 0 20px;"><span class="checkmark" style="box-sizing: border-box; color: #086dd6; margin-right: 5px;">&#x2713;</span> Note version history (up to 100 years)</p>
+ </li>
+ <li style="line-height: 1.3; margin-bottom: 10px; box-sizing: border-box;">
+ <p style="line-height: 1.3 !important; color: black !important; box-sizing: border-box; margin: 0.5rem 0 20px;"><span class="checkmark" style="box-sizing: border-box; color: #086dd6; margin-right: 5px;">&#x2713;</span> Automatic daily backups of your data to your email inbox, Dropbox, OneDrive, and Google Drive</p>
+ </li>
+ <li style="line-height: 1.3; margin-bottom: 10px; box-sizing: border-box;">
+ <p style="line-height: 1.3 !important; color: black !important; box-sizing: border-box; margin: 0.5rem 0 20px;"><span class="checkmark" style="box-sizing: border-box; color: #086dd6; margin-right: 5px;">&#x2713;</span> Two-factor authentication</p>
+ </li>
+ <li style="line-height: 1.3; margin-bottom: 10px; box-sizing: border-box;">
+ <p style="line-height: 1.3 !important; color: black !important; box-sizing: border-box; margin: 0.5rem 0 20px;"><span class="checkmark" style="box-sizing: border-box; color: #086dd6; margin-right: 5px;">&#x2713;</span> Support our mission for privacy and longevity in software</p>
+ </li>
+ </ul>
+ <a class="price-box blue" href="https://standardnotes.org/extensions" style="cursor: pointer; color: #086dd6; box-sizing: border-box; text-decoration: none;">
+ <p style="line-height: 1.3 !important; color: black !important; box-sizing: border-box; margin: 0.5rem 0 20px;">As low as</p>
+ <h1 class="amount" style="font-weight: 500; font-size: 1.5rem !important; line-height: 1.9rem; box-sizing: border-box; margin: 0; padding: 0;">$2.48/month</h1>
+ </a>
+ <a class="sk-button info right featured" style="margin-top: 20px; cursor: pointer; color: white; text-decoration: none; display: block; font-size: 1.1rem; text-align: center; background-color: #086DD6; box-sizing: border-box; padding: 0.75rem 1.25rem; border: 1px none #086dd6;" href="https://standardnotes.org/extensions">
+ <div class="sk-label" style="font-weight: bold; box-sizing: border-box;">Learn More</div>
+ </a>
+ </div>
+ </div>
+</div>
+ </div>
+ </div>
+ </div>
+ </body>
+</html>
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