1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-31 20:52:21 +01:00

configure default_mail_from from the UI

This commit is contained in:
Sylvain 2020-06-01 12:15:16 +02:00
parent 434c211ccf
commit 0617e4cd26
19 changed files with 194 additions and 98 deletions

View File

@ -2,7 +2,9 @@
- Improved display of the icons alerting about an outdated version
- Fix a bug: managers do not see the name of the user who reserved a slot
- Fix a bug: mailcatcher is not showing all emails
- [TODO DEPLOY] `rails fablab:setup:env_to_db`
- [TODO DEPLOY] -> (only dev) update mailcatcher from your [docker-compose.yml](docker/development/docker-compose.yml)
## v4.4.4 2020 May 25

View File

@ -1031,7 +1031,7 @@ angular.module('application.router', ['ui.router'])
resolve: {
settingsPromise: ['Setting', function (Setting) {
return Setting.query({
names: `['twitter_name', 'about_title', 'about_body', 'tracking_id', 'facebook_app_id', \
names: `['twitter_name', 'about_title', 'about_body', 'tracking_id', 'facebook_app_id', 'email_from', \
'privacy_body', 'privacy_dpo', 'about_contacts', 'book_overlapping_slots', 'invoicing_module', \
'home_blogpost', 'machine_explications_alert', 'training_explications_alert', 'slot_duration', \
'training_information_message', 'subscription_explications_alert', 'event_explications_alert', \

View File

@ -1,34 +1,34 @@
<div class="panel panel-default m-t-md">
<div class="panel-heading">
<span class="font-sbold" translate>{{ 'app.admin.settings.title' }}</span>
<span class="font-sbold" translate>{{ 'app.admin.settings.general.title' }}</span>
</div>
<div class="panel-body">
<div class="row m-t-lg">
<div class="col-md-4">
<text-setting name="fablab_name"
settings="allSettings"
label="app.admin.settings.fablab_title"
label="app.admin.settings.general.fablab_title"
fa-icon="fa-font">
</text-setting>
</div>
<div class="col-md-4 col-md-offset-1">
<form role="form" novalidate>
<h4 class="control-label m-r" translate>{{ 'app.admin.settings.title_concordance' }}</h4>
<h4 class="control-label m-r" translate>{{ 'app.admin.settings.general.title_concordance' }}</h4>
<div class="form-group">
<label for="nameGenreMale">
<input type="radio" name="nameGenre" id="nameGenreMale" ng-model="nameGenre.value" ng-value="'male'" />
{{ 'app.admin.settings.male' | translate }} <span style="font-weight: normal">{{ 'app.admin.settings.eg' | translate }} <cite>{{ 'app.admin.settings.the_team' | translate }} <strong translate>{{ 'app.admin.settings.male_preposition' }}</strong> {{allSettings.fablab_name}}</cite></span>
{{ 'app.admin.settings.general.male' | translate }} <span style="font-weight: normal">{{ 'app.admin.settings.general.eg' | translate }} <cite>{{ 'app.admin.settings.general.the_team' | translate }} <strong translate>{{ 'app.admin.settings.general.male_preposition' }}</strong> {{allSettings.fablab_name}}</cite></span>
</label>
<br/>
<label for="nameGenreFemale">
<input type="radio" name="nameGenre" id="nameGenreFemale" ng-model="nameGenre.value" ng-value="'female'" />
{{ 'app.admin.settings.female' | translate }} <span style="font-weight: normal">{{ 'app.admin.settings.eg' | translate }} <cite>{{ 'app.admin.settings.the_team' | translate }} <strong translate>{{ 'app.admin.settings.female_preposition' }}</strong> {{allSettings.fablab_name}}</cite></span>
{{ 'app.admin.settings.general.female' | translate }} <span style="font-weight: normal">{{ 'app.admin.settings.general.eg' | translate }} <cite>{{ 'app.admin.settings.general.the_team' | translate }} <strong translate>{{ 'app.admin.settings.general.female_preposition' }}</strong> {{allSettings.fablab_name}}</cite></span>
</label>
<br/>
<label for="nameGenreNeutral">
<input type="radio" name="nameGenre" id="nameGenreNeutral" ng-model="nameGenre.value" ng-value="'neutral'" />
{{ 'app.admin.settings.neutral' | translate }} <span style="font-weight: normal">{{ 'app.admin.settings.eg' | translate }} <cite>{{ 'app.admin.settings.the_team' | translate }} <strong translate>{{ 'app.admin.settings.neutral_preposition' }}</strong> {{allSettings.fablab_name}}</cite></span>
{{ 'app.admin.settings.general.neutral' | translate }} <span style="font-weight: normal">{{ 'app.admin.settings.general.eg' | translate }} <cite>{{ 'app.admin.settings.general.the_team' | translate }} <strong translate>{{ 'app.admin.settings.general.neutral_preposition' }}</strong> {{allSettings.fablab_name}}</cite></span>
</label>
</div>
<button name="button" class="btn btn-warning" ng-click="save(nameGenre)" translate>{{ 'app.shared.buttons.save' }}</button>
@ -318,20 +318,20 @@
<div class="panel panel-default m-t-lg">
<div class="panel-heading">
<span class="font-sbold" translate>{{ 'app.admin.settings.elements_ordering' }}</span>
<span class="font-sbold" translate>{{ 'app.admin.settings.general.elements_ordering' }}</span>
</div>
<div class="panel-body">
<div class="row">
<div class="col-md-4">
<h3 class="m-l" translate>{{ 'app.admin.settings.machines_order' }}</h3>
<h3 class="m-l" translate>{{ 'app.admin.settings.general.machines_order' }}</h3>
<select-setting name="machines_sort_by"
settings="allSettings"
classes="m-l"
label="app.admin.settings.display_machines_sorted_by"
option-1="['default', 'app.admin.settings.sort_by.default']"
option-2="['name', 'app.admin.settings.sort_by.name']"
option-3="['created_at', 'app.admin.settings.sort_by.created_at']"
option-4="['updated_at', 'app.admin.settings.sort_by.updated_at']">
label="app.admin.settings.general.display_machines_sorted_by"
option-1="['default', 'app.admin.settings.general.sort_by.default']"
option-2="['name', 'app.admin.settings.general.sort_by.name']"
option-3="['created_at', 'app.admin.settings.general.sort_by.created_at']"
option-4="['updated_at', 'app.admin.settings.general.sort_by.updated_at']">
</select-setting>
</div>
</div>
@ -340,27 +340,47 @@
<div class="panel panel-default m-t-lg">
<div class="panel-heading">
<span class="font-sbold" translate>{{ 'app.admin.settings.help' }}</span>
<span class="font-sbold" translate>{{ 'app.admin.settings.general.help' }}</span>
</div>
<div class="panel-body">
<div class="row">
<h3 class="m-l" translate>{{ 'app.admin.settings.feature_tour' }}</h3>
<p class="alert alert-warning m-h-md" ng-bind-html="'app.admin.settings.feature_tour_info_html' | translate"></p>
<h3 class="m-l" translate>{{ 'app.admin.settings.general.feature_tour' }}</h3>
<p class="alert alert-warning m-h-md" ng-bind-html="'app.admin.settings.general.feature_tour_info_html' | translate"></p>
<div class="col-md-4">
<select-setting name="feature_tour_display"
settings="allSettings"
classes="m-l"
required="true"
label="app.admin.settings.feature_tour_display_mode"
option-1="['once', 'app.admin.settings.display_mode.once']"
option-2="['session', 'app.admin.settings.display_mode.session']"
option-3="['manual', 'app.admin.settings.display_mode.manual']">
label="app.admin.settings.general.feature_tour_display_mode"
option-1="['once', 'app.admin.settings.general.display_mode.once']"
option-2="['session', 'app.admin.settings.general.display_mode.session']"
option-3="['manual', 'app.admin.settings.general.display_mode.manual']">
</select-setting>
</div>
</div>
</div>
</div>
<div class="panel panel-default m-t-lg">
<div class="panel-heading">
<span class="font-sbold" translate>{{ 'app.admin.settings.general.notifications' }}</span>
</div>
<div class="panel-body">
<div class="row">
<h3 class="m-l" translate>{{ 'app.admin.settings.general.email' }}</h3>
<p class="alert alert-warning m-h-md" translate>{{ 'app.admin.settings.general.email_info' }}</p>
<div class="col-md-4">
<text-setting name="email_from"
settings="allSettings"
label="app.admin.settings.general.email_from"
fa-icon="fa-paper-plane"
placeholder="noreply@example.com">
</text-setting>
</div>
</div>
</div>
</div>
<div class="panel panel-default m-t-md">
<div class="panel-heading">
<span class="font-sbold" translate>{{ 'app.admin.settings.account_creation' }}</span>

View File

@ -26,7 +26,7 @@
<div class="col-md-12">
<uib-tabset justified="true" active="tabs.active">
<uib-tab heading="{{ 'app.admin.settings.general' | translate }}" index="0">
<uib-tab heading="{{ 'app.admin.settings.general.general' | translate }}" index="0">
<ng-include src="'<%= asset_path "admin/settings/general.html" %>'"></ng-include>
</uib-tab>

View File

@ -2,7 +2,7 @@
# Mailer configuration
class BaseMailer < ActionMailer::Base
default from: ENV['DEFAULT_MAIL_FROM']
default from: Setting.get('mail_from')
layout 'notifications_mailer'
helper :application

View File

@ -2,7 +2,7 @@
# Handle most of the emails sent by the platform. Triggered by notifications
class NotificationsMailer < NotifyWith::NotificationsMailer
default from: ENV['DEFAULT_MAIL_FROM']
default from: Setting.get('mail_from')
layout 'notifications_mailer'
helper :application

View File

@ -0,0 +1,9 @@
# frozen_string_literal: true
# Override the default Devise settings for emails notifications
class OverwrittenDeviseMailer < Devise::Mailer
helper :application
include Devise::Controllers::UrlHelpers
default template_path: 'devise/mailer'
default from: ->(*) { Setting.get('mail_from') }
end

View File

@ -88,7 +88,8 @@ class Setting < ApplicationRecord
twitter_analytics
recaptcha_site_key
recaptcha_secret_key
feature_tour_display] }
feature_tour_display
email_from] }
def value
last_value = history_values.order(HistoryValue.arel_table['created_at'].desc).first
last_value&.value

View File

@ -11,13 +11,8 @@ Devise.setup do |config|
# config.secret_key = 'f0ad7aadec8086b90c0427e734602262e5d211147f3d93b5b94b5263ffd245e9fd9fcd672dcadea1d9ee2b1bffbf2712cdb013883d66943ef5bed93a263fe11a'
# ==> Mailer Configuration
# Configure the e-mail address which will be shown in Devise::Mailer,
# note that it will be overwritten if you use your own mailer class
# with default "from" parameter.
config.mailer_sender = ENV['DEFAULT_MAIL_FROM']
# Configure the class responsible to send e-mails.
# config.mailer = 'Devise::Mailer'
config.mailer = 'OverwrittenDeviseMailer'
# ==> ORM configuration
# Load and configure the ORM. Supports :active_record (default) and

View File

@ -894,21 +894,9 @@ en:
date: "Date"
#global application parameters and customization
settings:
title: "Title"
customize_the_application: "Customize the application"
general: "General"
fablab_title: "FabLab title"
fablab_name: "FabLab name"
title_concordance: "Title concordance"
male: "Male."
female: "Female."
neutral: "Neutral."
eg: "eg:"
about: "About"
the_team: "The team of"
male_preposition: "the"
female_preposition: "the"
neutral_preposition: ""
customize_information_messages: "Customize information messages"
message_of_the_machine_booking_page: "Message of the machine booking page:"
type_the_message_content: "Type the message content"
@ -1028,9 +1016,6 @@ en:
twitter_analytics: "Twitter analytics account"
book_overlapping_slots: "book overlapping slots"
slot_duration: "slots duration"
elements_ordering: "Elements ordering"
machines_order: "Machines order"
display_machines_sorted_by: "Display machines sorted by"
advanced: "Advanced settings"
customize_home_page_css: "Customise the stylesheet of the home page"
home_css_notice_html: "You can customize the stylesheet which will apply to the home page, using the <a href=\"https://sass-lang.com/documentation\" target=\"_blank\">SASS</a> syntax. These styles will be automatically subordinated to the <code>.home-page</code> selector to prevent any risk of breaking the application. Meanwhile please be careful, any changes in the home page editor at the top of the page may broke your styles, always refer to the HTML code."
@ -1063,20 +1048,41 @@ en:
secret_key: "Secret key"
recaptcha_site_key: "reCAPTCHA Site Key"
recaptcha_secret_key: "reCAPTCHA Secret Key"
help: "Help"
feature_tour: "Feature tour"
feature_tour_info_html: "<p>When an administrator or a manager in logged-in, a feature tour will be triggered the first time he/she visits each section of the application. You can change this behavior to one of the following values:</p><ul><li>« Once » to keep the default behavior.</li><li>« By session » to display the tours each time you reopen the application.</li><li>« Manual trigger » to prevent displaying the tours automatically. It'll still be possible to trigger them by pressing the F1 key or by clicking on « Help » in the user's menu.</li></ul>"
feature_tour_display_mode: "Feature tour display mode"
feature_tour_display: "feature tour display"
display_mode:
once: "Once"
session: "By session"
manual: "Manual trigger"
email_from: "expeditor's address"
general:
general: "General"
title: "Title"
fablab_title: "FabLab title"
title_concordance: "Title concordance"
male: "Male."
female: "Female."
neutral: "Neutral."
eg: "eg:"
the_team: "The team of"
male_preposition: "the"
female_preposition: "the"
neutral_preposition: ""
elements_ordering: "Elements ordering"
machines_order: "Machines order"
display_machines_sorted_by: "Display machines sorted by"
sort_by:
default: "Default"
name: "Name"
created_at: "Creation date"
updated_at: "Last update date"
help: "Help"
feature_tour: "Feature tour"
feature_tour_info_html: "<p>When an administrator or a manager in logged-in, a feature tour will be triggered the first time he/she visits each section of the application. You can change this behavior to one of the following values:</p><ul><li>« Once » to keep the default behavior.</li><li>« By session » to display the tours each time you reopen the application.</li><li>« Manual trigger » to prevent displaying the tours automatically. It'll still be possible to trigger them by pressing the F1 key or by clicking on « Help » in the user's menu.</li></ul>"
feature_tour_display_mode: "Feature tour display mode"
display_mode:
once: "Once"
session: "By session"
manual: "Manual trigger"
notifications: "Notifications"
email: "Email"
email_info: "The email address from which notifications will be sent. You can use a non-existing address (like noreply@...) or an existing address if you want to allow your members to reply to the notifications they receive."
email_from: "Expeditor's address"
privacy:
title: "Privacy"
privacy_policy: "Privacy policy"

View File

@ -894,21 +894,8 @@ fr:
date: "Date"
#global application parameters and customization
settings:
title: "Titre"
customize_the_application: "Personnalisation de l'application"
general: "Général"
fablab_title: "Titre du FabLab"
fablab_name: "Nom du FabLab"
title_concordance: "Accord du titre"
male: "Masculin."
female: "Féminin."
neutral: "Neutre."
eg: "ex :"
about: "A propos"
the_team: "L'équipe"
male_preposition: "du"
female_preposition: "de la"
neutral_preposition: ""
customize_information_messages: "Personnaliser les messages d'informations"
message_of_the_machine_booking_page: "Message sur la page de réservation d'une machine :"
type_the_message_content: "Saisir le contenu du message"
@ -1028,9 +1015,6 @@ fr:
twitter_analytics: "compte Twitter analytics"
book_overlapping_slots: "réservation de créneaux simultanés"
slot_duration: "durée des créneaux"
elements_ordering: "Ordre d'affichage des éléments"
machines_order: "Ordre des machines"
display_machines_sorted_by: "Afficher les machines triées par"
advanced: "Paramètres avancés"
customize_home_page_css: "Personnaliser la feuille de style de la page d'accueil"
home_css_notice_html: "Vous pouvez personnaliser la feuille de style qui s'appliquera à la page d'accueil en utilisant la syntaxe <a href=\"https://sass-lang.com/documentation\" target=\"_blank\">SASS</a>. Ces styles seront automatiquement subordonnées au sélecteur <code>.home-page</code> pour prévenir tout risque de casse de l'application. Attention toutefois, les modifications de la page d'accueil dans l'éditeur en haut de page peuvent rendre caduque vos styles, référez vous toujours au code HTML."
@ -1063,20 +1047,43 @@ fr:
secret_key: "Clef secrète"
recaptcha_site_key: "clef de site reCAPTCHA"
recaptcha_secret_key: "clef secrète reCAPTCHA"
help: "Aide"
feature_tour: "Visite guidée des fonctionnalités"
feature_tour_info_html: "<p>Lorsque un administrateur ou un gestionnaire est connecté, une visite guidée des fonctionnalités se déclenchera lors de la première visite de chaque section de l'application. Vous pouvez modifier ce comportement pour une des valeur suivantes :</p><ul><li>« Une fois » pour garder le comportment par défaut.</li><li>« Par session » pour afficher les visites guidées chaque fois que l'application est ouverte de nouveau.</li><li>« Lancement manuel » pour éviter l'affichage automatique des visites guidées. Il sera toujours possible de les déclencher en appuyant sur F1 ou en cliquant sur « Aide » dans le menu utilisateur.</li></ul>"
feature_tour_display_mode: "Mode d'affichage des visites guidées"
feature_tour_display: "l'affichage des visites guidées"
display_mode:
once: "Une fois"
session: "Par session"
manual: "Lancement manuel"
email_from: "l'adresse de l'expéditeur"
general:
general: "Général"
title: "Titre"
fablab_title: "Titre du FabLab"
fablab_name: "Nom du FabLab"
title_concordance: "Accord du titre"
male: "Masculin."
female: "Féminin."
neutral: "Neutre."
eg: "ex :"
about: "A propos"
the_team: "L'équipe"
male_preposition: "du"
female_preposition: "de la"
neutral_preposition: ""
elements_ordering: "Ordre d'affichage des éléments"
machines_order: "Ordre des machines"
display_machines_sorted_by: "Afficher les machines triées par"
sort_by:
default: "Défaut"
name: "Nom"
created_at: "Date de création"
updated_at: "Date de mise à jour"
help: "Aide"
feature_tour: "Visite guidée des fonctionnalités"
feature_tour_info_html: "<p>Lorsque un administrateur ou un gestionnaire est connecté, une visite guidée des fonctionnalités se déclenchera lors de la première visite de chaque section de l'application. Vous pouvez modifier ce comportement pour une des valeur suivantes :</p><ul><li>« Une fois » pour garder le comportment par défaut.</li><li>« Par session » pour afficher les visites guidées chaque fois que l'application est ouverte de nouveau.</li><li>« Lancement manuel » pour éviter l'affichage automatique des visites guidées. Il sera toujours possible de les déclencher en appuyant sur F1 ou en cliquant sur « Aide » dans le menu utilisateur.</li></ul>"
feature_tour_display_mode: "Mode d'affichage des visites guidées"
display_mode:
once: "Une fois"
session: "Par session"
manual: "Lancement manuel"
notifications: "Notifications"
email: "Courriel"
email_info: "L'adresse de courriel depuis laquelle les notifications seront envoyées. Vous pouvez utiliser une adresse qui n'existe pas (comme ne-pas-repondre@...) ou une adresse existante si vous voulez que vos membres puisse répondre aux notifications qu'ils reçoivent."
email_from: "Adresse de l'expéditeur"
privacy:
title: "Confidentialité"
privacy_policy: "Politique de confidentialité"

View File

@ -857,6 +857,8 @@ Setting.set('invoicing_module', true) unless Setting.find_by(name: 'invoicing_mo
Setting.set('feature_tour_display', 'once') unless Setting.find_by(name: 'feature_tour_display').try(:value)
Setting.set('email_from', 'noreply@fab-manager.com') unless Setting.find_by(name: 'email_from').try(:value)
if StatisticCustomAggregation.count.zero?
# available reservations hours for machines
machine_hours = StatisticType.find_by(key: 'hour', statistic_index_id: 2)

View File

@ -99,11 +99,6 @@ This is useful if you won't use wallet system.
If set to 'true' the users will need to confirm their email address to be able to sign in.
Set to 'false' if you don't want this behaviour.
<a name="DEFAULT_MAIL_FROM"></a>
DEFAULT_MAIL_FROM
When sending notification mails, the platform will use this address to identify the sender.
<a name="DELIVERY_METHOD"></a>
DELIVERY_METHOD

View File

@ -65,7 +65,7 @@ services:
# - "6379:6379"
mailcatcher:
image: sj26/mailcatcher
image: sleede/mailcatcher
restart: always
## linux
networks:

View File

@ -22,8 +22,6 @@ FABLAB_WITHOUT_WALLET=false
USER_CONFIRMATION_NEEDED_TO_SIGN_IN=false
DEFAULT_MAIL_FROM=Fab-manager Demo <noreply@fab-manager.com>
# Configure carefully!
DEFAULT_HOST=localhost:5000
DEFAULT_PROTOCOL=http

View File

@ -118,7 +118,8 @@ namespace :fablab do
%w[_ TWITTER_NAME twitter_analytics],
%w[_ RECAPTCHA_SITE_KEY recaptcha_site_key],
%w[_ RECAPTCHA_SECRET_KEY recaptcha_secret_key],
%w[_ FEATURE_TOUR_DISPLAY feature_tour_display once]
%w[_ FEATURE_TOUR_DISPLAY feature_tour_display once],
%w[_ DEFAULT_MAIL_FROM email_from]
]
mapping.each do |m|

View File

@ -16,7 +16,6 @@ FABLAB_WITHOUT_WALLET=false
SLOT_DURATION=60
FEATURE_TOUR_DISPLAY=once
DEFAULT_MAIL_FROM=Fab-manager Demo <noreply@fab-manager.com>
DEFAULT_HOST=demo.fab-manager.com
DEFAULT_PROTOCOL=http

View File

@ -593,3 +593,39 @@ history_value_61:
created_at: 2020-05-22 15:22:08.254410000 Z
updated_at: 2020-05-22 15:22:08.254410000 Z
footprint:
history_value_62:
id: 62
setting_id: 62
invoicing_profile_id: 1
value: 'false'
created_at: 2020-06-01 11:12:21.255550000 Z
updated_at: 2020-06-01 11:12:21.255550000 Z
footprint:
history_value_63:
id: 63
setting_id: 63
invoicing_profile_id: 1
value: 'true'
created_at: 2020-06-01 11:12:21.255550000 Z
updated_at: 2020-06-01 11:12:21.255550000 Z
footprint:
history_value_64:
id: 64
setting_id: 64
invoicing_profile_id: 1
value: 'once'
created_at: 2020-06-01 11:12:21.255550000 Z
updated_at: 2020-06-01 11:12:21.255550000 Z
footprint:
history_value_65:
id: 65
setting_id: 65
invoicing_profile_id: 1
value: 'noreply@fab-manager.com'
created_at: 2020-06-01 11:12:21.255550000 Z
updated_at: 2020-06-01 11:12:21.255550000 Z
footprint:

View File

@ -358,3 +358,28 @@ setting_61:
name: slot_duration
created_at: 2020-05-22 15:20:25.254250000 Z
updated_at: 2020-05-22 15:20:25.254250000 Z
setting_62:
id: 62
name: spaces_module
created_at: 2020-06-01 11:12:21.255550000 Z
updated_at: 2020-06-01 11:12:21.255550000 Z
setting_63:
id: 63
name: plans_module
created_at: 2020-06-01 11:12:21.255550000 Z
updated_at: 2020-06-01 11:12:21.255550000 Z
setting_64:
id: 64
name: feature_tour_display
created_at: 2020-06-01 11:12:21.255550000 Z
updated_at: 2020-06-01 11:12:21.255550000 Z
setting_65:
id: 65
name: email_from
created_at: 2020-06-01 11:12:21.255550000 Z
updated_at: 2020-06-01 11:12:21.255550000 Z