aboutsummaryrefslogtreecommitdiffstats
path: root/app/mailers/rodauth_mailer.rb
diff options
context:
space:
mode:
authorsadbeast <sadbeast@sadbeast.com>2024-01-31 17:47:56 -0800
committersadbeast <sadbeast@sadbeast.com>2024-01-31 17:47:56 -0800
commit332ec93366315fa1ed7b4acd7a3407c96e8ddfa7 (patch)
tree6ae553317f12a7a6a29c849c8805ffab96436dc2 /app/mailers/rodauth_mailer.rb
downloadtd-332ec93366315fa1ed7b4acd7a3407c96e8ddfa7.tar.gz
td-332ec93366315fa1ed7b4acd7a3407c96e8ddfa7.tar.bz2
initial mistakeHEADmain
Diffstat (limited to 'app/mailers/rodauth_mailer.rb')
-rw-r--r--app/mailers/rodauth_mailer.rb62
1 files changed, 62 insertions, 0 deletions
diff --git a/app/mailers/rodauth_mailer.rb b/app/mailers/rodauth_mailer.rb
new file mode 100644
index 0000000..6782c87
--- /dev/null
+++ b/app/mailers/rodauth_mailer.rb
@@ -0,0 +1,62 @@
+class RodauthMailer < ApplicationMailer
+ default to: -> { @rodauth.email_to }, from: -> { @rodauth.email_from }
+
+ def verify_account(name, account_id, key)
+ @rodauth = rodauth(name, account_id) { @verify_account_key_value = key }
+ @account = @rodauth.rails_account
+
+ mail subject: @rodauth.email_subject_prefix + @rodauth.verify_account_email_subject
+ end
+
+ def reset_password(name, account_id, key)
+ @rodauth = rodauth(name, account_id) { @reset_password_key_value = key }
+ @account = @rodauth.rails_account
+
+ mail subject: @rodauth.email_subject_prefix + @rodauth.reset_password_email_subject
+ end
+
+ def verify_login_change(name, account_id, key)
+ @rodauth = rodauth(name, account_id) { @verify_login_change_key_value = key }
+ @account = @rodauth.rails_account
+ @new_email = @account.login_change_key.login
+
+ mail to: @new_email, subject: @rodauth.email_subject_prefix + @rodauth.verify_login_change_email_subject
+ end
+
+ def password_changed(name, account_id)
+ @rodauth = rodauth(name, account_id)
+ @account = @rodauth.rails_account
+
+ mail subject: @rodauth.email_subject_prefix + @rodauth.password_changed_email_subject
+ end
+
+ # def reset_password_notify(name, account_id)
+ # @rodauth = rodauth(name, account_id)
+ # @account = @rodauth.rails_account
+
+ # mail subject: @rodauth.email_subject_prefix + @rodauth.reset_password_notify_email_subject
+ # end
+
+ # def email_auth(name, account_id, key)
+ # @rodauth = rodauth(name, account_id) { @email_auth_key_value = key }
+ # @account = @rodauth.rails_account
+
+ # mail subject: @rodauth.email_subject_prefix + @rodauth.email_auth_email_subject
+ # end
+
+ # def unlock_account(name, account_id, key)
+ # @rodauth = rodauth(name, account_id) { @unlock_account_key_value = key }
+ # @account = @rodauth.rails_account
+
+ # mail subject: @rodauth.email_subject_prefix + @rodauth.unlock_account_email_subject
+ # end
+
+ private
+
+ def rodauth(name, account_id, &block)
+ instance = RodauthApp.rodauth(name).allocate
+ instance.instance_eval { @account = account_ds(account_id).first! }
+ instance.instance_eval(&block) if block
+ instance
+ end
+end