rodauth 0.10.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +146 -0
  3. data/README.rdoc +644 -220
  4. data/Rakefile +99 -11
  5. data/doc/account_expiration.rdoc +55 -0
  6. data/doc/base.rdoc +104 -0
  7. data/doc/change_login.rdoc +29 -0
  8. data/doc/change_password.rdoc +26 -0
  9. data/doc/close_account.rdoc +31 -0
  10. data/doc/confirm_password.rdoc +22 -0
  11. data/doc/create_account.rdoc +34 -0
  12. data/doc/disallow_password_reuse.rdoc +37 -0
  13. data/doc/email_base.rdoc +19 -0
  14. data/doc/jwt.rdoc +35 -0
  15. data/doc/lockout.rdoc +83 -0
  16. data/doc/login.rdoc +27 -0
  17. data/doc/login_password_requirements_base.rdoc +50 -0
  18. data/doc/logout.rdoc +21 -0
  19. data/doc/otp.rdoc +100 -0
  20. data/doc/password_complexity.rdoc +50 -0
  21. data/doc/password_expiration.rdoc +52 -0
  22. data/doc/password_grace_period.rdoc +10 -0
  23. data/doc/recovery_codes.rdoc +60 -0
  24. data/doc/release_notes/1.0.0.txt +443 -0
  25. data/doc/remember.rdoc +82 -0
  26. data/doc/reset_password.rdoc +70 -0
  27. data/doc/session_expiration.rdoc +27 -0
  28. data/doc/single_session.rdoc +43 -0
  29. data/doc/sms_codes.rdoc +119 -0
  30. data/doc/two_factor_base.rdoc +27 -0
  31. data/doc/verify_account.rdoc +70 -0
  32. data/doc/verify_account_grace_period.rdoc +15 -0
  33. data/doc/verify_change_login.rdoc +9 -0
  34. data/lib/roda/plugins/rodauth.rb +3 -262
  35. data/lib/rodauth.rb +260 -0
  36. data/lib/rodauth/features/account_expiration.rb +108 -0
  37. data/lib/rodauth/features/base.rb +479 -0
  38. data/lib/rodauth/features/change_login.rb +77 -0
  39. data/lib/rodauth/features/change_password.rb +66 -0
  40. data/lib/rodauth/features/close_account.rb +82 -0
  41. data/lib/rodauth/features/confirm_password.rb +51 -0
  42. data/lib/rodauth/features/create_account.rb +128 -0
  43. data/lib/rodauth/features/disallow_password_reuse.rb +82 -0
  44. data/lib/rodauth/features/email_base.rb +63 -0
  45. data/lib/rodauth/features/jwt.rb +151 -0
  46. data/lib/rodauth/features/lockout.rb +262 -0
  47. data/lib/rodauth/features/login.rb +61 -0
  48. data/lib/rodauth/features/login_password_requirements_base.rb +123 -0
  49. data/lib/rodauth/features/logout.rb +37 -0
  50. data/lib/rodauth/features/otp.rb +338 -0
  51. data/lib/rodauth/features/password_complexity.rb +89 -0
  52. data/lib/rodauth/features/password_expiration.rb +111 -0
  53. data/lib/rodauth/features/password_grace_period.rb +46 -0
  54. data/lib/rodauth/features/recovery_codes.rb +240 -0
  55. data/lib/rodauth/features/remember.rb +200 -0
  56. data/lib/rodauth/features/reset_password.rb +207 -0
  57. data/lib/rodauth/features/session_expiration.rb +55 -0
  58. data/lib/rodauth/features/single_session.rb +87 -0
  59. data/lib/rodauth/features/sms_codes.rb +498 -0
  60. data/lib/rodauth/features/two_factor_base.rb +135 -0
  61. data/lib/rodauth/features/verify_account.rb +232 -0
  62. data/lib/rodauth/features/verify_account_grace_period.rb +76 -0
  63. data/lib/rodauth/features/verify_change_login.rb +20 -0
  64. data/lib/rodauth/migrations.rb +130 -0
  65. data/lib/rodauth/version.rb +9 -0
  66. data/spec/account_expiration_spec.rb +90 -0
  67. data/spec/all.rb +1 -0
  68. data/spec/change_login_spec.rb +149 -0
  69. data/spec/change_password_spec.rb +177 -0
  70. data/spec/close_account_spec.rb +162 -0
  71. data/spec/confirm_password_spec.rb +70 -0
  72. data/spec/create_account_spec.rb +127 -0
  73. data/spec/disallow_password_reuse_spec.rb +84 -0
  74. data/spec/lockout_spec.rb +228 -0
  75. data/spec/login_spec.rb +188 -0
  76. data/spec/migrate/001_tables.rb +103 -16
  77. data/spec/migrate/002_account_password_hash_column.rb +11 -0
  78. data/spec/migrate_password/001_tables.rb +60 -42
  79. data/spec/migrate_travis/001_tables.rb +116 -0
  80. data/spec/password_complexity_spec.rb +108 -0
  81. data/spec/password_expiration_spec.rb +243 -0
  82. data/spec/password_grace_period_spec.rb +93 -0
  83. data/spec/remember_spec.rb +424 -0
  84. data/spec/reset_password_spec.rb +185 -0
  85. data/spec/rodauth_spec.rb +57 -980
  86. data/spec/session_expiration_spec.rb +58 -0
  87. data/spec/single_session_spec.rb +107 -0
  88. data/spec/spec_helper.rb +202 -0
  89. data/spec/two_factor_spec.rb +1310 -0
  90. data/spec/verify_account_grace_period_spec.rb +135 -0
  91. data/spec/verify_account_spec.rb +142 -0
  92. data/spec/verify_change_login_spec.rb +46 -0
  93. data/spec/views/login.str +2 -2
  94. data/templates/add-recovery-codes.str +2 -0
  95. data/templates/button.str +5 -0
  96. data/templates/change-login.str +5 -18
  97. data/templates/change-password.str +6 -14
  98. data/templates/close-account.str +3 -6
  99. data/templates/confirm-password.str +4 -14
  100. data/templates/create-account.str +6 -30
  101. data/templates/login-confirm-field.str +6 -0
  102. data/templates/login-field.str +6 -0
  103. data/templates/login.str +5 -19
  104. data/templates/logout.str +2 -6
  105. data/templates/otp-auth-code-field.str +6 -0
  106. data/templates/otp-auth.str +8 -0
  107. data/templates/otp-disable.str +6 -0
  108. data/templates/otp-setup.str +21 -0
  109. data/templates/password-confirm-field.str +6 -0
  110. data/templates/password-field.str +6 -0
  111. data/templates/recovery-auth.str +12 -0
  112. data/templates/recovery-codes.str +6 -0
  113. data/templates/remember.str +8 -12
  114. data/templates/reset-password-request.str +2 -2
  115. data/templates/reset-password.str +4 -18
  116. data/templates/sms-auth.str +6 -0
  117. data/templates/sms-code-field.str +6 -0
  118. data/templates/sms-confirm.str +7 -0
  119. data/templates/sms-disable.str +7 -0
  120. data/templates/sms-request.str +5 -0
  121. data/templates/sms-setup.str +12 -0
  122. data/templates/unlock-account-request.str +3 -7
  123. data/templates/unlock-account.str +4 -7
  124. data/templates/verify-account-resend.str +2 -2
  125. data/templates/verify-account.str +2 -6
  126. metadata +191 -29
  127. data/lib/roda/plugins/rodauth/base.rb +0 -428
  128. data/lib/roda/plugins/rodauth/change_login.rb +0 -48
  129. data/lib/roda/plugins/rodauth/change_password.rb +0 -42
  130. data/lib/roda/plugins/rodauth/close_account.rb +0 -42
  131. data/lib/roda/plugins/rodauth/create_account.rb +0 -92
  132. data/lib/roda/plugins/rodauth/lockout.rb +0 -292
  133. data/lib/roda/plugins/rodauth/login.rb +0 -81
  134. data/lib/roda/plugins/rodauth/logout.rb +0 -36
  135. data/lib/roda/plugins/rodauth/remember.rb +0 -226
  136. data/lib/roda/plugins/rodauth/reset_password.rb +0 -205
  137. data/lib/roda/plugins/rodauth/verify_account.rb +0 -228
@@ -0,0 +1,82 @@
1
+ = Documentation for Remember Feature
2
+
3
+ The remember feature allows for token-based autologin for users. It records
4
+ which sessions were autologged in via a token, and allows you to request
5
+ password confirmation later for such sessions if they are accessing a
6
+ section requiring more security. The remember feature depends on the
7
+ logout feature.
8
+
9
+ == Auth Value Methods
10
+
11
+ extend_remember_deadline? :: Whether to extend the remember token deadline
12
+ when the user is autologged in via token.
13
+ remember_additional_form_tags :: HTML fragment containing additional
14
+ form tags to use on the change remember
15
+ setting form.
16
+ remember_button :: The text to use for the change remember settings button.
17
+ remember_cookie_key :: The cookie name to use for the remember token.
18
+ remember_cookie_options :: Any options to set for the remember cookie.
19
+ remember_deadline_column :: The column name in the remember keys table storing
20
+ the deadline after which the token will be
21
+ ignored.
22
+ remember_deadline_interval :: The amount of time for which to remember accounts,
23
+ 14 days by default.
24
+ remember_disable_label :: The label for disabling remembering.
25
+ remember_disable_param_value :: The parameter value for disabling remembering.
26
+ remember_error_flash :: The flash error to show if there is an error changing a
27
+ remember setting.
28
+ remember_forget_label :: The label for turning off remembering.
29
+ remember_forget_param_value :: The parameter value for turning off remembering.
30
+ remember_id_column :: The id column in the remember keys table, should be a
31
+ foreign key referencing the accounts table.
32
+ remember_key_column :: The remember key/token column in the remember keys table.
33
+ remember_notice_flash :: The flash notice to show after remember setting
34
+ has been updated.
35
+ remember_period :: The additional time to extend the remember deadline if
36
+ extending remember deadlines.
37
+ remember_redirect :: Where to redirect after changing the remember settings.
38
+ remember_remember_param_value :: The parameter value for switching on remembering.
39
+ remember_remember_label :: The label for turning on remembering.
40
+ remember_route :: The route to the change remember settings action.
41
+ remember_table :: The name of the remember keys table.
42
+ remember_param :: The parameter name to use for the remember password settings
43
+ choice.
44
+ remembered_session_key :: The key in the session storing whether the current
45
+ session has been autologged in via remember token.
46
+
47
+
48
+ == Auth Methods
49
+
50
+ add_remember_key :: Add a remember key for the current account to the remember
51
+ keys table.
52
+ after_load_memory :: Run arbitrary code after autologging in an account via
53
+ a remember token.
54
+ after_remember :: Run arbitrary code after changing the remember settings.
55
+ before_load_memory :: Run arbitrary code before autologging in an account via
56
+ a remember token.
57
+ before_remember :: Run arbitrary code before changing the remember settings.
58
+ before_remember_route :: Run arbitrary code before handling the remember route.
59
+ clear_remembered_session_key :: Clear the flag for whether the current
60
+ account was autologged in via token, called
61
+ after successful password confirmation.
62
+ disable_remember_login :: Disable the remember key token, clearing the token
63
+ from the database so future connections with the
64
+ token will not be recognized.
65
+ forget_login :: Forget the current remember token, deleting the related cookie.
66
+ Other browsers that have the cookie cached can still use it
67
+ login.
68
+ generate_remember_key_value :: A random string to use as the remember key.
69
+ get_remember_key :: Retrieve the remember key from the database.
70
+ load_memory :: If the remember key cookie is included in the request, and the
71
+ user is not currently logged in, check the remember keys table
72
+ and autologin the user if the remember key cookie matches the
73
+ current remember key for the account. This method needs to be
74
+ called manually inside the Roda route block to autologin users.
75
+ logged_in_via_remember_key? :: Whether the current session was logged in via
76
+ a remember key.
77
+ remember_key_value :: The current value of the remember key/token.
78
+ remember_login :: Set the cookie containing the remember token, so that future
79
+ sessions will be autologged in.
80
+ remember_view :: The HTML to use for the change remember settings form.
81
+ remove_remember_key(id_value=account_id) :: Delete the related remember key from
82
+ the database.
@@ -0,0 +1,70 @@
1
+ = Documentation for Reset Password Feature
2
+
3
+ The reset password feature implements password resets. If the user enters
4
+ an invalid password, they will be displayed a form where they can request
5
+ a password reset. Submitting that form will send an email containing a
6
+ link, and that link will taken them to a password reset form. Depends on
7
+ the login feature.
8
+
9
+ == Auth Value Methods
10
+
11
+ no_matching_reset_password_key_message :: The flash error message to show if attempting
12
+ to access the reset password form with an
13
+ invalid key.
14
+ reset_password_additional_form_tags :: HTML fragment containing additional form
15
+ tags to use on the reset password form.
16
+ reset_password_autologin? :: Whether to autologin the user after successfully
17
+ resetting a password.
18
+ reset_password_button :: The text to use for the reset password button.
19
+ reset_password_deadline_column :: The column name in the reset password keys table storing
20
+ the deadline after which the token will be ignored.
21
+ reset_password_deadline_interval :: The amount of time for which to allow users to
22
+ reset their passwords, 1 day by default.
23
+ reset_password_email_sent_notice_flash :: The flash notice to show after a reset
24
+ password email has been sent.
25
+ reset_password_email_sent_redirect :: Where to redirect after sending a reset
26
+ password email.
27
+ reset_password_email_subject :: The subject to use for reset password emails.
28
+ reset_password_error_flash :: The flash error to show after resetting a password.
29
+ reset_password_id_column :: The id column in the reset password keys table, should
30
+ be a foreign key referencing the accounts table.
31
+ reset_password_key_column :: The reset password key/token column in the reset
32
+ password keys table.
33
+ reset_password_key_param :: The parameter name to use for the reset password key.
34
+ reset_password_redirect :: Where to redirect after resetting a password.
35
+ reset_password_request_additional_form_tags :: HTML fragment containing additional form
36
+ tags to use on the reset password request
37
+ form.
38
+ reset_password_request_button :: The text to use for the reset password request button.
39
+ reset_password_request_error_flash :: The flash error to show if not able to send a reset
40
+ password email.
41
+ reset_password_request_route :: The route to the reset password request action.
42
+ reset_password_route :: The route to the reset password action.
43
+ reset_password_table :: The name of the reset password keys table.
44
+
45
+ == Auth Methods
46
+
47
+ account_from_reset_password_key(key) :: Retrieve the account using the given reset
48
+ password key, or return nil if no account
49
+ matches.
50
+ after_reset_password :: Run arbitrary code after successfully resetting a password.
51
+ after_reset_password_request :: Run arbitrary code after sending the reset password
52
+ email.
53
+ before_reset_password :: Run arbitrary code before resetting a password.
54
+ before_reset_password_request :: Run arbitrary code before sending the reset password
55
+ email.
56
+ before_reset_password_route :: Run arbitrary code before handling a reset password route.
57
+ create_reset_password_key :: A random string to use as a reset password key.
58
+ get_reset_password_key(id) :: Get the password reset key for the given account id
59
+ from the database.
60
+ create_reset_password_email :: A Mail::Message for the reset password email.
61
+ remove_reset_password_key :: Remove the reset password key for the current account,
62
+ run after successful password reset.
63
+ reset_password_email_body :: The body to use for the reset password email.
64
+ reset_password_email_link :: The link to the reset password form in the reset
65
+ password email.
66
+ reset_password_key_insert_hash :: The hash to insert into the reset password keys
67
+ table.
68
+ reset_password_key_value :: The reset password key for the current account.
69
+ reset_password_view :: The HTML to use for the reset password form.
70
+ send_reset_password_email :: Send the reset password email.
@@ -0,0 +1,27 @@
1
+ = Documentation for Session Expiration Feature
2
+
3
+ The session expiration feature allows setting an inactivity timeout and a max
4
+ lifetime for sessions. When this feature is used, you should use
5
+ +rodauth.check_session_expiration+ at the top (or other appropriate place)
6
+ in your routing tree.
7
+
8
+ route do |r|
9
+ rodauth.check_session_expiration
10
+ r.rodauth
11
+
12
+ # ...
13
+ end
14
+
15
+ When checking session expiration, if the last activity was more than the
16
+ inactivity timeout, or the session was created more the maximum lifetime
17
+ ago, the session is cleared, and the user is redirected to the login page.
18
+
19
+ == Auth Value Methods
20
+
21
+ max_session_lifetime :: The maximum number of seconds since session creation that sessions will be valid for, regardless of session activity. 86400 by default (1 day).
22
+ session_created_session_key :: The session key storing the session creation timestamp.
23
+ session_expiration_default :: Whether to expire sessions that don't have the created at or last activity at timestamps set, true by default.
24
+ session_expiration_error_flash :: The flash error to show if a session expires.
25
+ session_expiration_redirect :: Where to redirect if a session expires.
26
+ session_inactivity_timeout :: The maximum number of seconds allowed since the last activity before the session will be considered invalid. 1800 by default (30 minutes).
27
+ session_last_activity_session_key :: The session key storing the last session activity timestamp.
@@ -0,0 +1,43 @@
1
+ = Documentation for Single Session Feature
2
+
3
+ The single session feature stores the key for the session in a
4
+ database table whenever a user logs in to the system. In your
5
+ routing block, you can check that the session key given matches
6
+ the stored key by doing:
7
+
8
+ rodauth.check_single_session
9
+
10
+ Note that it is not recommended to use this feature unless you
11
+ have a policy that requires it. Many users find it useful to
12
+ be able to have multiple concurrent sessions, and restricting
13
+ this ability does not make things more secure.
14
+
15
+ Note that one of the side benefits with this feature is that
16
+ logouts reset the single session key, so attempts to reuse
17
+ the previous session after logout no longer work.
18
+
19
+ == Auth Value Methods
20
+
21
+ single_session_id_column :: The column in the +single_session_table+ containing
22
+ the account id.
23
+ single_session_key_column :: The column in the +single_session_table+ containing
24
+ the single session key.
25
+ single_session_error_flash :: The flash error to display if the current session
26
+ is no longer the active session for the account.
27
+ single_session_redirect :: Where to redirect if the current session is no longer
28
+ the active session for the account.
29
+ single_session_session_key :: The session key name to use for storing the single
30
+ session key.
31
+ single_session_table :: The database table storing single session keys.
32
+
33
+ == Auth Methods
34
+
35
+ currently_active_session? :: Whether the current session is the active session for
36
+ the user.
37
+ no_longer_active_session :: The action to take if the current session is no longer
38
+ the active session for the user.
39
+ reset_single_session_key :: Reset the single session key for the user, by default
40
+ to a new random key.
41
+ update_single_session_key :: Update the single session key in the current session
42
+ and in the database, reflecting that the current
43
+ session is the active session for the user.
@@ -0,0 +1,119 @@
1
+ = Documentation for SMS Codes Feature
2
+
3
+ The sms codes feature allows 2nd factor authentication via codes provided via
4
+ SMS messages. It is usually used as a backup if OTP authentication is not available
5
+ or has been locked out, but it can be used as the primary 2nd factor.
6
+
7
+ This feature allows users to register their mobile phone number with the system, confirm that
8
+ they can receive SMS messages on the mobile phone number they have registered, request
9
+ SMS authentication codes, authenticate via SMS codes, and disable SMS authentication.
10
+
11
+ While this feature sets up all of the infrastructure needed to support SMS authentication,
12
+ it doesn't handle sending SMS messages itself. There are many ruby libraries that send
13
+ SMS messages, and you can choose which one to use. When using this feature, you must
14
+ use the +sms_send+ configuration method and send the SMS using whatever SMS library
15
+ you prefer:
16
+
17
+ sms_send do |phone_number, message|
18
+ # ...
19
+ end
20
+
21
+ == Auth Value Methods
22
+
23
+ no_current_sms_code_error_flash :: The flash error to show when going to the SMS authentication page and no current SMS authentication code is available.
24
+ sms_already_setup_error_flash :: The flash error to show when goign to a page to setup SMS authentication if SMS authentication has already been setup.
25
+ sms_already_setup_redirect :: Where to redirect when going to a page to setup SMS authentication if SMS authentication has already been setup.
26
+ sms_auth_additional_form_tags :: HTML fragment containing additional form tags when authenticating via SMS.
27
+ sms_auth_button :: Text to use for button on form to authenticate via SMS.
28
+ sms_auth_code_length :: The length of SMS authentication codes, 6 by default.
29
+ sms_auth_redirect :: Where to redirect if SMS authentication is needed.
30
+ sms_auth_route :: The route to the SMS authentication action.
31
+ sms_code_allowed_seconds :: The number of seconds after an SMS authentication is sent until it is no longer valid, 300 seconds by default.
32
+ sms_code_column :: The column in the +sms_codes_table+ containing the currently valid SMS authentication/confirmation code.
33
+ sms_code_label :: The label for SMS codes.
34
+ sms_code_param :: The parameter name for SMS codes.
35
+ sms_codes_table :: The name of the table storing SMS code data.
36
+ sms_codes_primary? :: Whether SMS codes are the primary 2nd factor authentication method, true by default if not using the otp feature.
37
+ sms_confirm_additional_form_tags :: HTML fragment containing additional form tags when confirming SMS setup.
38
+ sms_confirm_button :: Text to use for button on form to confirm SMS setup.
39
+ sms_confirm_code_length :: The length of SMS confirmation codes, 12 by default, as there is no lockout.
40
+ sms_confirm_notice_flash :: The flash notice to show when SMS authentication setup has been confirmed.
41
+ sms_confirm_redirect ::Where to redirect after SMS authentication setup has been confirmed.
42
+ sms_confirm_route :: The route to the SMS setup confirmation action.
43
+ sms_disable_additional_form_tags :: HTML fragment containing additional form tags when disabling SMS authentication.
44
+ sms_disable_button :: Text to use for button on form to disable SMS authentication.
45
+ sms_disable_error_flash :: The flash error to show when disabling SMS authentication fails.
46
+ sms_disable_notice_flash :: The flash notice to show when SMS authentication has been successfully disabled.
47
+ sms_disable_redirect :: Where to redirect after SMS authentication has been disabled.
48
+ sms_disable_route :: The route to the SMS authentication disable action.
49
+ sms_failure_limit :: The number of failures until SMS authentication is locked out.
50
+ sms_failures_column :: The column in the +sms_codes_table+ containing the number of SMS authentication failures since the last successful authentication.
51
+ sms_id_column :: The column in the +sms_codes_table+ containing the account id.
52
+ sms_invalid_code_error_flash :: The flash error to show when an invalid SMS authentication code is used.
53
+ sms_invalid_code_message :: The error message to show when an invalid SMS code is used.
54
+ sms_invalid_confirmation_code_error_flash :: The flash error to show when an invalid SMS confirmation code is used.
55
+ sms_invalid_phone_message :: The error message to show when an invalid SMS phone number is used.
56
+ sms_issued_at_column :: The column in the +sms_codes_table+ containing the time the SMS code was issued.
57
+ sms_lockout_error_flash :: The flash error to show when SMS authentication has been locked out due to repeated failures.
58
+ sms_lockout_redirect :: Where to redirect after SMS authentication has been locked out.
59
+ sms_needs_confirmation_error_flash :: The flash error to show on SMS authentication pages when SMS authentication setup needs confirmation.
60
+ sms_needs_confirmation_redirect :: Where to redirect after SMS setup, when confirmation is required.
61
+ sms_needs_setup_redirect :: Where to redirect if going to an SMS authentication page when SMS authentication has not been setup.
62
+ sms_not_setup_error_flash :: The flash error to show when on SMS authentication pages when SMS authentication has not yet been setup.
63
+ sms_phone_column :: The column in the +sms_codes_table+ containing the phone number to which to send SMS messages.
64
+ sms_phone_label :: The label for SMS phone numbers.
65
+ sms_phone_min_length :: The minimum length of phone numbers allowed for SMS authentication, 7 by default.
66
+ sms_phone_param :: The parameter name for SMS phone numbers.
67
+ sms_request_additional_form_tags :: HTML fragment containing additional form tags when requesting an SMS authentication code.
68
+ sms_request_button :: Text to use for button on form to request an SMS authentication code.
69
+ sms_request_notice_flash :: The flash notice to show when an SMS authentication code is requested.
70
+ sms_request_redirect :: Where to redirect after requesting an SMS authentication code.
71
+ sms_request_route :: The route to the SMS authentication code request action.
72
+ sms_setup_additional_form_tags :: HTML fragment containing additional form tags when setting up SMS authentication.
73
+ sms_setup_button :: Text to use for button on form to setup SMS authentication.
74
+ sms_setup_error_flash :: The flash error to show when setting up SMS authentication fails.
75
+ sms_setup_route :: The route to the SMS authentication setup action.
76
+
77
+ == Auth Methods
78
+
79
+ after_sms_confirm :: Run arbitrary code after successful SMS authentication confirmation.
80
+ after_sms_disable :: Run arbitrary code after disabling SMS authentication.
81
+ after_sms_failure :: Run arbitrary code after SMS authentication failure.
82
+ after_sms_request :: Run arbitrary code after SMS authentication code request.
83
+ after_sms_setup :: Run arbitrary code after SMS authentication setup.
84
+ before_sms_auth :: Run arbitrary code before SMS authentication.
85
+ before_sms_auth_route :: Run arbitrary code before handling SMS authentication route.
86
+ before_sms_confirm :: Run arbitrary code before SMS confirmation.
87
+ before_sms_confirm_route :: Run arbitrary code before handling SMS confirmation route.
88
+ before_sms_disable :: Run arbitrary code before disabling SMS authentication.
89
+ before_sms_disable_route :: Run arbitrary code before handling SMS disable route.
90
+ before_sms_request :: Run arbitrary code before sending SMS code.
91
+ before_sms_request_route :: Run arbitrary code before handling SMS request route.
92
+ before_sms_setup :: Run arbitrary code before setting up SMS authentication.
93
+ before_sms_setup_route :: Run arbitrary code before handling SMS setup route.
94
+ sms_auth_message(code) :: The SMS message to use for the given authentication code.
95
+ sms_auth_view :: The HTML to use for the form to authenticate via SMS code.
96
+ sms_available? :: Whether SMS authentication is ready for use.
97
+ sms_code_issued_at :: The timestamp the current SMS code was issued at.
98
+ sms_code_match?(code) :: Whether there is an active SMS authentication code for the current account and the given code matches it.
99
+ sms_confirm_message(code) :: The SMS message to use for the given confirmation code.
100
+ sms_confirm_view :: The HTML to use for the form to authenticate via SMS code.
101
+ sms_confirmation_match?(code) :: Whether there is an active SMS confirmation code for the current account and the given code matches it.
102
+ sms_current_auth? :: Whether there is a active SMS authentication code for the current account.
103
+ sms_disable :: Action to take to disable SMS authentication for the account.
104
+ sms_disable_view :: The HTML to use for the form to disable SMS authentication.
105
+ sms_failures :: The number of SMS authentication failures since the last successfully SMS authentication for this account.
106
+ sms_locked_out? :: Whether SMS authentication has been locked out for the current account.
107
+ sms_needs_confirmation? :: Whether SMS authentication has been setup but not confirmed for the current account.
108
+ sms_new_auth_code :: A new SMS authentication code that can be used for the account.
109
+ sms_new_confirm_code :: A new SMS confirmation code that can be used for the account.
110
+ sms_normalize_phone(phone) :: A normalized version of the given phone number, by default removing everything except 0-9.
111
+ sms_record_failure :: Record an SMS authentication failure for the current account.
112
+ sms_remove_failures :: Reset the SMS authentication failure counter for the current account, used after a successful SMS authentication.
113
+ sms_request_view :: The HTML to use for the form to request an SMS authentication code.
114
+ sms_send(phone, message) :: Send the given message to the given phone number via SMS. By default a NotImplementedError is raised, this is the only method that must be overridden.
115
+ sms_set_code(code) :: Set the SMS authentication code for the current account to the given code. The code can be +nil+ to specify that no SMS authentication code is currently valid.
116
+ sms_setup :: Setup SMS authentication for the current account.
117
+ sms_setup? :: Whether SMS authentication has been setup and confirmed for the current account.
118
+ sms_setup_view :: The HTML to use for the form to setup SMS authentication.
119
+ sms_valid_phone?(phone) :: Whether the given phone number is a valid phone number.
@@ -0,0 +1,27 @@
1
+ = Documentation for Two Factor Base Feature
2
+
3
+ The two factor base feature implements shared functionality for the other 2nd
4
+ factor authentication features.
5
+
6
+ == Auth Value Methods
7
+
8
+ two_factor_already_authenticated_error_flash :: The flash error to show if going to a two factor authentication page when already authenticated via 2nd factor
9
+ two_factor_already_authenticated_redirect :: Where to redirect if going to a two factor authentication page when already authenticated via 2nd factor.
10
+ two_factor_auth_notice_flash :: The flash notice to show after a successful two factor authentication.
11
+ two_factor_auth_redirect :: Whether to redirect after a successful two factor authentication.
12
+ two_factor_auth_required_redirect :: Where to redirect if going to a page requiring two factor authentication when not authenticated via 2nd factor.
13
+ two_factor_modifications_require_password? :: Whether modifications to two factor authentication require the use of passwords.
14
+ two_factor_need_authentication_error_flash :: The flash error to show if going to a page that requires two factor authentication when not authenticated.
15
+ two_factor_need_setup_redirect :: Where to redirect if going to a two factor authentication page when two factor authentication has not been setup.
16
+ two_factor_not_setup_error_flash :: The flash error to show if going to a two factor authentication page when two factor authentication has not been setup.
17
+ two_factor_session_key :: The session key used for storing a symbol indicating which type of 2nd factor was used to authenticate.
18
+ two_factor_setup_session_key :: The session key used for storing whether two factor authentication has been setup for the current account.
19
+
20
+ == Auth Methods
21
+
22
+ after_two_factor_authentication :: Any actions to take after successful two factor authentication.
23
+ two_factor_authenticated? :: Whether the current session has already been authenticated via 2nd factor.
24
+ two_factor_remove :: Any action to take to remove two factor authentication, called when closing accounts.
25
+ two_factor_remove_auth_failures :: Any action to take to remove 2nd factor authentication failures, called after a successful 2nd factor authentication.
26
+ two_factor_remove_session :: What actions to take to remove two factor authentication, called when disabling two factor authentication.
27
+ two_factor_update_session(type) :: How to update the session to reflect a successful two factor authentication.
@@ -0,0 +1,70 @@
1
+ = Documentation for Verify Account Feature
2
+
3
+ The verify account feature implements account verification after account
4
+ creation. After account creation, users are sent an email containing
5
+ a link to verify the account. Users cannot login to the account until
6
+ after verifying the account. Depends on the login and create account features.
7
+
8
+ == Auth Value Methods
9
+
10
+ attempt_to_create_unverified_account_notice_message :: Message displayed when attempting to
11
+ create an account awaiting verification.
12
+ attempt_to_login_to_unverified_account_notice_message :: Message displayed when attempting to
13
+ login to an account awaiting verification.
14
+ no_matching_verify_account_key_message :: The flash error message to show when
15
+ an invalid verify account key is used.
16
+ verify_account_additional_form_tags :: HTML fragment containing additional form
17
+ tags to use on the verify account form.
18
+ verify_account_autologin? :: Whether to autologin the user after successful
19
+ account verification, true by default.
20
+ verify_account_button :: The text to use for the verify account button.
21
+ verify_account_email_subject :: The subject to use for the verify account email.
22
+ verify_account_email_sent_redirect :: Where to redirect after sending the verify
23
+ account email.
24
+ verify_account_email_sent_notice_flash :: The flash notice to set after sending
25
+ the verify account email.
26
+ verify_account_error_flash :: The flash error to show if no matching key is submitted
27
+ when verifying an account.
28
+ verify_account_id_column :: The id column in the verify account keys table, should
29
+ be a foreign key referencing the accounts table.
30
+ verify_account_key_column :: The verify account key/token column in the verify
31
+ account keys table.
32
+ verify_account_key_param :: The parameter name to use for the verify account key.
33
+ verify_account_notice_flash :: The flash notice to show after verifying the account.
34
+ verify_account_resend_additional_form_tags :: HTML fragment containing additional form
35
+ tags to use on the page requesting
36
+ resending the verify account email.
37
+ verify_account_resend_button :: The text to use for the verify account resend button.
38
+ verify_account_redirect :: Where to redirect after verifying the account.
39
+ verify_account_resend_error_flash :: The flash error to show if unable to resend a
40
+ verify account email.
41
+ verify_account_resend_route :: The route to the verify account resend action.
42
+ verify_account_route :: The route to the verify account action.
43
+ verify_account_table :: The name of the verify account keys table.
44
+
45
+ == Auth Methods
46
+
47
+ account_from_verify_account_key(key) :: Retrieve the account using the given verify
48
+ account key, or return nil if no account
49
+ matches.
50
+ after_verify_account :: Run arbitrary code after verifying the account.
51
+ after_verify_account_resend :: Run arbitrary code after resending a verify account email.
52
+ before_verify_account :: Run arbitrary code before verifying the account.
53
+ before_verify_account_resend :: Run arbitrary code before resending a verify account email.
54
+ before_verify_account_route :: Run arbitrary code before handling a verify account route.
55
+ create_verify_account_key :: A random string to use as a verify account key.
56
+ create_verify_account_email :: A Mail::Message for the verify account email.
57
+ get_verify_account_key(id) :: Get the verify account key for the given account id
58
+ from the database.
59
+ remove_verify_account_key :: Remove the verify account key for the current account,
60
+ run after successful account verification.
61
+ resend_verify_account_view :: The HTML to use for page requesting resending the
62
+ verify account email.
63
+ send_verify_account_email :: Send the verify account email.
64
+ verify_account :: Verify the account by changing the status from unverified to open.
65
+ verify_account_email_body :: The body to use for the verify account email.
66
+ verify_account_email_link :: The link to the verify account form in the verify
67
+ account email.
68
+ verify_account_key_insert_hash :: The hash to insert into the verify account keys
69
+ table.
70
+ verify_account_view :: The HTML to use for the verify account form.
@@ -0,0 +1,15 @@
1
+ = Documentation for Verify Account Grace Period Feature
2
+
3
+ The verify account grace period feature allows users to login for
4
+ a given period of time (1 day by default) before their account is
5
+ verified. Depends on the verify account feature.
6
+
7
+ == Auth Value Methods
8
+
9
+ verification_requested_at_column :: The column in the +verify_account_table+ table that holds the verification requested timestamp.
10
+ unverified_account_session_key :: The session key set if the logged in account has not been unverified.
11
+ verify_account_grace_period :: The amount of seconds after an account creation that a user will be able to login without verifying (86400 by default).
12
+
13
+ == Auth Methods
14
+
15
+ account_in_unverified_grace_period? :: Whether the current account is in an unverified grace period.