module Authpwn::SessionMailer
Included by the session mailer class.
Parts of the codebase assume the mailer will be named SessionMailer
.
Public Instance Methods
Creates an e-mail containing a verification token for the e-mail address.
@param [String] token the e-mail confirmation token @param [String] the application's root URL (e.g. “localhost:3000/”)
# File lib/authpwn_rails/session_mailer.rb, line 12 def email_verification_email(token, root_url) @token = token @protocol, @host = *root_url.split('://', 2) @host.slice!(-1) if @host[-1] == ?/ hostname = @host.split(':', 2).first # Strip out any port. mail to: @token.email, subject: email_verification_subject(token, hostname, @protocol), from: email_verification_from(token, hostname, @protocol) end
The sender e-mail address for an e-mail verification e-mail.
The authpwn generator encourages applications to override this method.
# File lib/authpwn_rails/session_mailer.rb, line 33 def email_verification_from(token, server_hostname, protocol) %Q|"#{server_hostname} staff" <admin@#{server_hostname}>| end
The subject line in an e-mail verification e-mail.
The authpwn generator encourages applications to override this method.
# File lib/authpwn_rails/session_mailer.rb, line 26 def email_verification_subject(token, server_hostname, protocol) "#{server_hostname} e-mail verification" end
Creates an e-mail containing a password reset token.
@param [String] email the email to send the token to @param [String] token the password reset token @param [String] root_url the application's root URL
(e.g. "https://localhost:3000/")
# File lib/authpwn_rails/session_mailer.rb, line 43 def reset_password_email(email, token, root_url) @email, @token, @host, @protocol = email, token @token = token @protocol, @host = *root_url.split('://', 2) @host.slice!(-1) if @host[-1] == ?/ hostname = @host.split(':', 2).first # Strip out any port. mail to: email, from: reset_password_from(token, hostname, @protocol), subject: reset_password_subject(token, hostname, @protocol) end
The sender e-mail address for a password reset e-mail.
The authpwn generator encourages applications to override this method.
# File lib/authpwn_rails/session_mailer.rb, line 64 def reset_password_from(token, server_hostname, protocol) %Q|"#{server_hostname} staff" <admin@#{server_hostname}>| end
The subject line in a password reset e-mail.
The authpwn generator encourages applications to override this method.
# File lib/authpwn_rails/session_mailer.rb, line 57 def reset_password_subject(token, server_hostname, protocol) "#{server_hostname} password reset" end