fix reset password

This commit is contained in:
spen 2014-05-02 13:54:49 +08:00
parent e5293acee5
commit 7bb1b48c25
5 changed files with 54 additions and 2 deletions

View File

@ -1,3 +1,35 @@
class UserMailer < Devise::Mailer
default :from => "noreply@rulingcom.com"
# default :from => "noreply@rulingcom.com"
@site = Site.first
@smtp_settings = {
:address => @site['site_settings']['address'],
:port => @site['site_settings']['port'],
:domain => @site['site_settings']['domain'],
:authentication => @site['site_settings']['authentication'],
:enable_starttls_auto => @site['site_settings']['enable_starttls_auto']
}
if !@site['site_settings']['user_name'].blank?
@smtp_settings[:user_name] = @site['site_settings']['user_name']
end
if !@site['site_settings']['password'].blank?
@smtp_settings[:password] = @site['site_settings']['password']
end
if !@site['site_settings']['service_email'].blank?
@smtp_settings[:from] = @site['site_settings']['service_email']
Devise.mailer_sender = @site['site_settings']['service_email']
end
if !@site['site_settings']['reply_email'].blank?
@smtp_settings[:reply_to] = @site['site_settings']['reply_email']
end
ActionMailer::Base.smtp_settings = @smtp_settings
end

View File

@ -0,0 +1,5 @@
<p>Welcome <%= @resource.email %>!</p>
<p>You can confirm your account through the link below:</p>
<p><%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %></p>

View File

@ -0,0 +1,8 @@
<p>Hello <%= @resource.email %>!</p>
<p>Someone has requested a link to change your password, and you can do this through the link below.</p>
<p><%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %></p>
<p>If you didn't request this, please ignore this email.</p>
<p>Your password won't change until you access the link above and create a new one.</p>

View File

@ -0,0 +1,7 @@
<p>Hello <%= @resource.email %>!</p>
<p>Your account has been locked due to an excessive amount of unsuccessful sign in attempts.</p>
<p>Click the link below to unlock your account:</p>
<p><%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) %></p>

View File

@ -6,7 +6,7 @@ Devise.setup do |config|
config.mailer_sender = "noreply@rulingcom.com"
# Configure the class responsible to send e-mails.
config.mailer = "Devise::Mailer"
config.mailer = "UserMailer"
# ==> ORM configuration
# Load and configure the ORM. Supports :active_record (default) and