Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Onboarding updates #1121

Merged
merged 7 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/users/confirmations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def create
end

# require valid password to confirm email
unless user.valid_password?(confirmation_params[:password])
unless user.valid_password?(confirmation_params[:password].to_s)
flash[:alert] = I18n.t('devise.failure.invalid_password')
redirect_to(user_confirmation_path(confirmation_token: confirmation_params[:confirmation_token]))
return
Expand Down
6 changes: 4 additions & 2 deletions app/mailers/application_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ def mail(recipient, sender, subject, html, text, attachment = nil)
raise(ArgumentError) if html.blank? && text.blank?

if ENV['MAILGUN_DOMAIN'].blank? || ENV['MAILGUN_TOKEN'].blank?
Rails.logger.error("mailgun credentials not send, cannot send email")
Rails.logger.error("mailgun credentials not set, cannot send email. Printing email instead.")
Rails.logger.info(html)
return
end

Expand All @@ -47,7 +48,8 @@ def mails(recipient, sender, subject, html, text, attachment = nil)
raise(ArgumentError) if (html.blank? && text.blank?) || recipient.blank?

if ENV['MAILGUN_DOMAIN'].blank? || ENV['MAILGUN_TOKEN'].blank?
Rails.logger.debug("mailgun credentials not send, cannot send email")
Rails.logger.debug("mailgun credentials not set, cannot send email. Printing email instead.")
Rails.logger.info(html)
return
end

Expand Down
10 changes: 6 additions & 4 deletions app/mailers/mailings/devise.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,19 @@ class Devise < ApplicationMailer
include ::Devise::Controllers::UrlHelpers

def confirmation_instructions(record, token, _opts = {})
Rails.logger.debug(confirmation_url(record, confirmation_token: token)) if Rails.env.development?
url = new_member_confirmation_url(confirmation_token: token)
TobiasDeBruijn marked this conversation as resolved.
Show resolved Hide resolved
Rails.logger.debug(url) if Rails.env.development?

html = render_to_string(locals: {
name: record.credentials.name,
confirmation_url: confirmation_url(record, confirmation_token: token),
confirmation_url: url,
subject: "#{ I18n.t('association_name') } | #{ I18n.t('mailings.devise.confirmation_instructions.confirm_email') }"
})

text = <<~PLAINTEXT
#{ I18n.t('mailings.greeting') } #{ record.credentials.name },

#{ I18n.t('mailings.devise.confirmation_instructions.link_instructions', confirm_link: confirmation_url(record, confirmation_token: token)) }
#{ I18n.t('mailings.devise.confirmation_instructions.link_instructions', confirm_link: url) }

#{ I18n.t('mailings.best_regards') }

Expand Down Expand Up @@ -49,7 +50,8 @@ def activation_instructions(record, token, _opts = {})
instagram_page_link_start: '<a href="https://www.instagram.com/stickyutrecht/">'.html_safe,
linkedin_page_link_start: '<a href="https://www.linkedin.com/company/studievereniging-sticky">'.html_safe,
sticky_site_link_start: '<a href="https://svsticky.nl">'.html_safe,
whatsapp_promo_link_start: '<a href="https://svsticky.nl/promokanaal">'.html_safe,
whatsapp_promo_link_start_nl: '<a href="https://svsticky.nl/promokanaal">'.html_safe,
whatsapp_promo_link_start_en: '<a href="https://svsticky.nl/promochannel">'.html_safe,
link_end: '</a>'.html_safe) }

## #{ I18n.t('mailings.devise.activation_instructions.corner_stones.education.name') }
Expand Down
6 changes: 3 additions & 3 deletions app/views/devise/confirmations/edit.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

- if flash[:alert]
.alert.alert-danger
%span
%span.dark:text-white
= flash[:alert]

- if flash[:notice]
Expand All @@ -18,7 +18,7 @@
= flash[:notice]

%fieldset
%h4{:style => "color:white;"}
%h4.dark:text-white
= I18n.t :activate, scope: 'devise.confirmations'

.form-group
Expand Down Expand Up @@ -48,7 +48,7 @@
-# i18n todo

.row
.text-center
.text-center.dark:text-white
= link_to (I18n.t 'devise.registrations.password_recovery'), new_user_password_path
|
= link_to (I18n.t 'devise.registrations.login'), new_user_session_path
2 changes: 1 addition & 1 deletion app/views/devise/confirmations/new.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
= flash[:notice]

%fieldset
%h4= I18n.t 'devise.confirmations.new.instruction'
%h4.dark:text-white= I18n.t 'devise.confirmations.new.instruction'

.form-group
.input-group-prepend
Expand Down
4 changes: 2 additions & 2 deletions app/views/devise/confirmations/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
= flash[:notice]

%fieldset
%h4= I18n.t 'devise.confirmations.new.instruction'
%h4.dark:text-white= I18n.t 'devise.confirmations.new.instruction'

.form-group
.input-group
Expand All @@ -39,7 +39,7 @@
= f.submit t('devise.confirmations.new.submit'), :class => 'btn btn-primary btn-block'

.row
.text-center
.text-center.dark:text-white
= link_to (I18n.t 'devise.registrations.login'), new_user_session_path
|
= link_to (I18n.t 'devise.registrations.sign_up'), new_registration_path
4 changes: 2 additions & 2 deletions app/views/layouts/doorkeeper.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@

.shadow.px-10.py-4.rounded-md.bg-white.mx-auto.dark:bg-gray-800.dark

- if current_user.present?
%h2.mt-2
- if current_user.present? and current_user.credentials.first_name?
%h2.mt-2.dark:text-white
= I18n.t('layouts.doorkeeper.hi')
%b= current_user.credentials.first_name
= I18n.t('layouts.doorkeeper.identity_confirmation', name: current_user.credentials.name)
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/mailer.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
.content{:style => "font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; max-width: 600px; display: block; margin: 0 auto; padding: 20px;"}
%table.main{:bgcolor => "#fff", :cellpadding => "0", :cellspacing => "0", :style => "font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; border-radius: 3px; background-color: #fff; margin: 0; border: 1px solid #e9e9e9;", :width => "100%"}
%tr{:style => "font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;"}
%td.alert.alert-warning{:align => "center", :bgcolor => "#197052", :style => "font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 16px; vertical-align: top; color: #fff; font-weight: 500; text-align: center; border-radius: 3px 3px 0 0; background-color: #197052; margin: 0; padding: 20px;", :valign => "top"}
%td.alert.alert-warning{:align => "center", :bgcolor => "#61518f", :style => "font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 16px; vertical-align: top; color: #fff; font-weight: 500; text-align: center; border-radius: 3px 3px 0 0; background-color: #61518f; margin: 0; padding: 20px;", :valign => "top"}
SpookyBoy99 marked this conversation as resolved.
Show resolved Hide resolved
= I18n.t('association_name')

%tr{:style => "font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;"}
Expand Down
10 changes: 6 additions & 4 deletions app/views/mailings/devise/activation_instructions.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
= t('mailings.devise.activation_instructions.about_sticky')

= t('mailings.devise.activation_instructions.activity_updates_html',
facebook_group_link_start: raw("<a href=\"https://www.facebook.com/groups/814759978565158\">"),
facebook_page_link_start: raw("<a href=\"https://www.facebook.com/stickyutrecht\">"),
sticky_site_link_start: raw("<a href=\"https://svsticky.nl\">"),
link_end: raw("</a>"))
instagram_page_link_start: '<a href="https://www.instagram.com/stickyutrecht/">'.html_safe,
linkedin_page_link_start: '<a href="https://www.linkedin.com/company/studievereniging-sticky">'.html_safe,
sticky_site_link_start: '<a href="https://svsticky.nl">'.html_safe,
whatsapp_promo_link_start_nl: '<a href="https://svsticky.nl/promokanaal">'.html_safe,
whatsapp_promo_link_start_en: '<a href="https://svsticky.nl/promochannel">'.html_safe,
link_end: '</a>'.html_safe)

%tr{:style => "font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;"}
%td.content-block{:style => "font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;", :valign => "top"}
Expand Down
2 changes: 1 addition & 1 deletion config/locales/mailings.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ en:
account_activation_instructions: Activate your account by clicking the button below
account_activation_link: Activate your account for our member system by going to %{url}.
activate_account: Activate account
activity_updates_html: 'Do you always want to stay informed about these activities? Follow our %{instagram_page_link_start} Sticky-members Instagram %{link_end} and follow our %{linkedin_page_link_start} our page %{link_end}! Aside from that, you can find all information that you could ever want on our website: %{sticky_site_link_start} svsticky.nl %{link_end}. You can also join our %{whatsapp_promo_link_start} WhatsApp promotion channel %{link_end} to be notified about upcoming activities!'
activity_updates_html: 'Do you always want to stay informed about these activities? Follow us on %{instagram_page_link_start} the Sticky-members Instagram %{link_end} and on %{linkedin_page_link_start} LinkedId %{link_end}! Aside from that, you can find all information that you could ever want on our website: %{sticky_site_link_start} svsticky.nl %{link_end}. You can also join our %{whatsapp_promo_link_start_en} WhatsApp promotion channel %{link_end} to be notified about upcoming activities!'
TobiasDeBruijn marked this conversation as resolved.
Show resolved Hide resolved
and_now: And now?
corner_stones:
business:
Expand Down
2 changes: 1 addition & 1 deletion config/locales/mailings.nl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ nl:
account_activation_instructions: 'Activeer je account door op onderstaande knop te klikken:'
account_activation_link: Activeer je account voor ons ledenbeheersysteem door naar %{url} te gaan.
activate_account: Activeer account
activity_updates_html: 'Altijd op de hoogte blijven van deze activiteiten? Volg ons op %{instagram_page_link_start} Instagram %{link_end} en volg ons op %{linkedin_page_link_start} LinkedIn %{link_end}! Daarnaast vind je alle informatie die je ooit had kunnen wensen op onze website: %{sticky_site_link_start} svsticky.nl %{link_end}. Je kunt ook lid worden van onze %{whatsapp_promo_link_start} WhatsApp community %{link_end} om altijd op de hoogte gehouden te worden van aankomende activiteiten!'
activity_updates_html: 'Altijd op de hoogte blijven van deze activiteiten? Volg ons op %{instagram_page_link_start} Instagram %{link_end} en op %{linkedin_page_link_start} LinkedIn %{link_end}! Daarnaast vind je alle informatie die je ooit had kunnen wensen op onze website: %{sticky_site_link_start} svsticky.nl %{link_end}. Je kunt ook lid worden van onze %{whatsapp_promo_link_start_nl} WhatsApp community %{link_end} om altijd op de hoogte gehouden te worden van aankomende activiteiten!'
TobiasDeBruijn marked this conversation as resolved.
Show resolved Hide resolved
and_now: En nu?
corner_stones:
business:
Expand Down
Loading