client_management/app/mailers/reset_c_panel_password_mail...

37 lines
1.3 KiB
Ruby
Raw Normal View History

2017-03-07 09:37:28 +00:00
class ResetCPanelPasswordMailer < ActionMailer::Base
default from: "noreply@rulingcom.com"
2017-04-12 11:15:59 +00:00
def setup
site = Site.first
mail_setting = {
: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'],
:user_name => site['site_settings']['user_name'].blank? ? nil : site['site_settings']['user_name'],
:password => site['site_settings']['password'].blank? ? nil : site['site_settings']['password']
}
ActionMailer::Base.smtp_settings = mail_setting
end
2017-03-07 09:37:28 +00:00
def reset_user_password(user)
2017-04-12 11:15:59 +00:00
setup
2017-03-07 09:37:28 +00:00
email = user.email
@reset_token = user.reset_token
@user_id = user.id
2017-04-12 11:25:36 +00:00
@url = "http://store.tp.rulingcom.com/cpanel/reset_password?id=#{@user_id}&token=#{@reset_token}"
2017-03-07 09:37:28 +00:00
mail(:to => email, :subject => "Reset Password Instructions")
end
def send_user_confirmation(user)
2017-04-12 11:15:59 +00:00
setup
2017-03-07 09:37:28 +00:00
@confirmation_token = user.confirmation_token
@user_id = user.id
2017-04-12 11:25:36 +00:00
@url = "http://store.tp.rulingcom.com/cpanel/confirm_email?id=#{@user_id}&token=#{@confirmation_token}"
2017-03-07 09:37:28 +00:00
mail(:to => user.email, :subject => "Orbit - Confirm Email")
end
end