rodauth 2.21.0 → 2.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/rodauth.rb CHANGED
@@ -233,6 +233,33 @@ module Rodauth
233
233
  end
234
234
  end
235
235
 
236
+ def email(type, subject, opts = {})
237
+ subject_method = :"#{type}_email_subject"
238
+ body_method = :"#{type}_email_body"
239
+ create_method = :"create_#{type}_email"
240
+ send_method = :"send_#{type}_email"
241
+
242
+ translatable_method subject_method, subject
243
+ auth_methods create_method, send_method
244
+
245
+ body_template = "#{type.to_s.tr('_', '-')}-email"
246
+ if opts[:translatable]
247
+ auth_value_methods body_method
248
+ define_method(body_method){translate(body_method, render(body_template))}
249
+ else
250
+ auth_methods body_method
251
+ define_method(body_method){render(body_template)}
252
+ end
253
+
254
+ define_method(create_method) do
255
+ create_email(send(subject_method), send(body_method))
256
+ end
257
+
258
+ define_method(send_method) do
259
+ send_email(send(create_method))
260
+ end
261
+ end
262
+
236
263
  def additional_form_tags(name=feature_name)
237
264
  auth_value_method(:"#{name}_additional_form_tags", nil)
238
265
  end
@@ -0,0 +1,2 @@
1
+ Someone (hopefully you) has reset the password for the account
2
+ associated to this email address.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rodauth
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.21.0
4
+ version: 2.24.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Evans
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-23 00:00:00.000000000 Z
11
+ date: 2022-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sequel
@@ -286,6 +286,7 @@ extra_rdoc_files:
286
286
  - doc/recovery_codes.rdoc
287
287
  - doc/remember.rdoc
288
288
  - doc/reset_password.rdoc
289
+ - doc/reset_password_notify.rdoc
289
290
  - doc/session_expiration.rdoc
290
291
  - doc/single_session.rdoc
291
292
  - doc/sms_codes.rdoc
@@ -336,6 +337,9 @@ extra_rdoc_files:
336
337
  - doc/release_notes/2.2.0.txt
337
338
  - doc/release_notes/2.20.0.txt
338
339
  - doc/release_notes/2.21.0.txt
340
+ - doc/release_notes/2.22.0.txt
341
+ - doc/release_notes/2.23.0.txt
342
+ - doc/release_notes/2.24.0.txt
339
343
  - doc/release_notes/2.3.0.txt
340
344
  - doc/release_notes/2.4.0.txt
341
345
  - doc/release_notes/2.5.0.txt
@@ -444,6 +448,9 @@ files:
444
448
  - doc/release_notes/2.2.0.txt
445
449
  - doc/release_notes/2.20.0.txt
446
450
  - doc/release_notes/2.21.0.txt
451
+ - doc/release_notes/2.22.0.txt
452
+ - doc/release_notes/2.23.0.txt
453
+ - doc/release_notes/2.24.0.txt
447
454
  - doc/release_notes/2.3.0.txt
448
455
  - doc/release_notes/2.4.0.txt
449
456
  - doc/release_notes/2.5.0.txt
@@ -453,6 +460,7 @@ files:
453
460
  - doc/release_notes/2.9.0.txt
454
461
  - doc/remember.rdoc
455
462
  - doc/reset_password.rdoc
463
+ - doc/reset_password_notify.rdoc
456
464
  - doc/session_expiration.rdoc
457
465
  - doc/single_session.rdoc
458
466
  - doc/sms_codes.rdoc
@@ -502,6 +510,7 @@ files:
502
510
  - lib/rodauth/features/recovery_codes.rb
503
511
  - lib/rodauth/features/remember.rb
504
512
  - lib/rodauth/features/reset_password.rb
513
+ - lib/rodauth/features/reset_password_notify.rb
505
514
  - lib/rodauth/features/session_expiration.rb
506
515
  - lib/rodauth/features/single_session.rb
507
516
  - lib/rodauth/features/sms_codes.rb
@@ -545,6 +554,7 @@ files:
545
554
  - templates/recovery-codes.str
546
555
  - templates/remember.str
547
556
  - templates/reset-password-email.str
557
+ - templates/reset-password-notify-email.str
548
558
  - templates/reset-password-request.str
549
559
  - templates/reset-password.str
550
560
  - templates/sms-auth.str
@@ -567,13 +577,13 @@ files:
567
577
  - templates/webauthn-auth.str
568
578
  - templates/webauthn-remove.str
569
579
  - templates/webauthn-setup.str
570
- homepage: https://github.com/jeremyevans/rodauth
580
+ homepage: https://rodauth.jeremyevans.net
571
581
  licenses:
572
582
  - MIT
573
583
  metadata:
574
584
  bug_tracker_uri: https://github.com/jeremyevans/rodauth/issues
575
- changelog_uri: http://rodauth.jeremyevans.net/rdoc/files/CHANGELOG.html
576
- documentation_uri: http://rodauth.jeremyevans.net/documentation.html
585
+ changelog_uri: https://rodauth.jeremyevans.net/rdoc/files/CHANGELOG.html
586
+ documentation_uri: https://rodauth.jeremyevans.net/documentation.html
577
587
  mailing_list_uri: https://github.com/jeremyevans/rodauth/discussions
578
588
  source_code_uri: https://github.com/jeremyevans/rodauth
579
589
  post_install_message: