activate emails
This commit is contained in:
parent
9f7f29f327
commit
b407d40747
@ -14,9 +14,6 @@ class OauthsController < ApplicationController
|
||||
else
|
||||
begin
|
||||
@user = create_from(provider)
|
||||
# NOTE: this is the place to add '@user.activate!' if you
|
||||
# are using user_activation submodule
|
||||
|
||||
reset_session # protect from session fixation attack
|
||||
auto_login(@user)
|
||||
redirect_to root_path, notice: "Logged in from #{provider.titleize}!"
|
||||
|
@ -1,2 +0,0 @@
|
||||
module OauthsHelper
|
||||
end
|
@ -1,6 +1,23 @@
|
||||
class AccountMailer < ApplicationMailer
|
||||
def activation_needed
|
||||
@blarg = "This was blarg"
|
||||
mail(to: 'markamoser+test@gmail.com', subject: 'Activate me please!')
|
||||
# Subject can be set in your I18n file at config/locales/en.yml
|
||||
# with the following lookup:
|
||||
#
|
||||
# en.account_mailer.activation_needed_email.subject
|
||||
#
|
||||
def activation_needed_email(user)
|
||||
@greeting = "Hi"
|
||||
@user = user
|
||||
mail to: Person.admins.map(&:email).join(', ')
|
||||
end
|
||||
|
||||
# Subject can be set in your I18n file at config/locales/en.yml
|
||||
# with the following lookup:
|
||||
#
|
||||
# en.account_mailer.activation_success_email.subject
|
||||
#
|
||||
def activation_success_email(user)
|
||||
@greeting = "Hi"
|
||||
@user = user
|
||||
mail to: user.email
|
||||
end
|
||||
end
|
||||
|
@ -1,4 +0,0 @@
|
||||
!!!
|
||||
%h3 Activate me please
|
||||
|
||||
%p and then: #{@blarg}
|
@ -0,0 +1,4 @@
|
||||
%h1= "AccountMailer#" + @action.to_s
|
||||
|
||||
%p
|
||||
= @greeting + ", find me in app/views/account_mailer/activation_needed_email.html.haml"
|
@ -0,0 +1,3 @@
|
||||
AccountMailer#activation_needed_email
|
||||
|
||||
= @greeting + ", find me in app/views/account_mailer/activation_needed_email.text.haml"
|
@ -0,0 +1,4 @@
|
||||
%h1= "AccountMailer#" + @action.to_s
|
||||
|
||||
%p
|
||||
= @greeting + ", find me in app/views/account_mailer/activation_success_email.html.haml"
|
@ -0,0 +1,3 @@
|
||||
AccountMailer#activation_success_email
|
||||
|
||||
= @greeting + ", find me in app/views/account_mailer/activation_success_email.text.haml"
|
@ -1,3 +1,4 @@
|
||||
!!!
|
||||
%hmtl
|
||||
%body
|
||||
= yield
|
||||
= yield
|
||||
|
@ -282,7 +282,7 @@ Rails.application.config.sorcery.configure do |config|
|
||||
# your mailer class. Required.
|
||||
# Default: `nil`
|
||||
#
|
||||
# user.user_activation_mailer =
|
||||
user.user_activation_mailer = AccountMailer
|
||||
|
||||
|
||||
# when true sorcery will not automatically
|
||||
@ -290,7 +290,7 @@ Rails.application.config.sorcery.configure do |config|
|
||||
# manually handle how and when email is sent.
|
||||
# Default: `false`
|
||||
#
|
||||
user.activation_mailer_disabled = true
|
||||
# user.activation_mailer_disabled =
|
||||
|
||||
|
||||
# activation needed email method on your mailer class.
|
||||
|
@ -1,7 +1,21 @@
|
||||
require 'test_helper'
|
||||
|
||||
class AccountMailerTest < ActionMailer::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
test "activation_needed_email" do
|
||||
user = Person.new
|
||||
mail = AccountMailer.activation_needed_email user
|
||||
assert_equal "Activation needed email", mail.subject
|
||||
assert_match "Hi", mail.body.encoded
|
||||
# assert_equal ["to@example.org"], mail.to
|
||||
# assert_equal ["from@example.com"], mail.from
|
||||
end
|
||||
|
||||
test "activation_success_email" do
|
||||
user = Person.new
|
||||
mail = AccountMailer.activation_success_email user
|
||||
assert_equal "Activation success email", mail.subject
|
||||
assert_match "Hi", mail.body.encoded
|
||||
# assert_equal ["to@example.org"], mail.to
|
||||
# assert_equal ["from@example.com"], mail.from
|
||||
end
|
||||
end
|
||||
|
@ -1,3 +1,14 @@
|
||||
# Preview all emails at http://localhost:3000/rails/mailers/account_mailer
|
||||
class AccountMailerPreview < ActionMailer::Preview
|
||||
# Preview this email at http://localhost:3000/rails/mailers/account_mailer/activation_needed_email
|
||||
def activation_needed_email
|
||||
user = Person.new
|
||||
AccountMailer.activation_needed_email user
|
||||
end
|
||||
|
||||
# Preview this email at http://localhost:3000/rails/mailers/account_mailer/activation_success_email
|
||||
def activation_success_email
|
||||
user = Person.new
|
||||
AccountMailer.activation_success_email user
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user