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

Feat send email #134

Merged
merged 11 commits into from
Sep 9, 2021
Merged
Show file tree
Hide file tree
Changes from 4 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
1 change: 1 addition & 0 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def create

if user.valid?
user.lock_access!
UserMailer.with(user: user).uuid_created.deliver_now
syl-p marked this conversation as resolved.
Show resolved Hide resolved
user.save
else
return head 406 # Not acceptable
Expand Down
7 changes: 7 additions & 0 deletions app/mailers/user_mailer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class UserMailer < ApplicationMailer
def uuid_created
@user = params[:user]

mail(to: @user.email, subject: "Votre compte Pia à été créé")
syl-p marked this conversation as resolved.
Show resolved Hide resolved
end
end
1 change: 1 addition & 0 deletions app/views/user_mailer/uuid_created.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<%= I18n.t 'mail.uuid_created' %><%= @user.uuid %>
1 change: 1 addition & 0 deletions app/views/user_mailer/uuid_created.text.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<%= I18n.t 'mail.uuid_created' %><%= @user.uuid %>
2 changes: 2 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@

en:
hello: "Hello world"
syl-p marked this conversation as resolved.
Show resolved Hide resolved
mail:
uuid_created: "Your pia account was created, your uuid is: "
syl-p marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 4 additions & 0 deletions config/locales/fr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fr:
hello: "Hello world"
syl-p marked this conversation as resolved.
Show resolved Hide resolved
mail:
uuid_created: "Votre compte à été créé, voilà votre uuid: "
syl-p marked this conversation as resolved.
Show resolved Hide resolved