lib/rodauth/features/verify_account.rb in rodauth-1.19.1 vs lib/rodauth/features/verify_account.rb in rodauth-1.20.0

- old
+ new

@@ -2,13 +2,20 @@ module Rodauth Feature.define(:verify_account, :VerifyAccount) do depends :login, :create_account, :email_base + def_deprecated_alias :attempt_to_create_unverified_account_error_flash, :attempt_to_create_unverified_account_notice_message + def_deprecated_alias :attempt_to_login_to_unverified_account_error_flash, :attempt_to_login_to_unverified_account_notice_message + def_deprecated_alias :no_matching_verify_account_key_error_flash, :no_matching_verify_account_key_message + error_flash "Unable to verify account" error_flash "Unable to resend verify account email", 'verify_account_resend' error_flash "An email has recently been sent to you with a link to verify your account", 'verify_account_email_recently_sent' + error_flash "There was an error verifying your account: invalid verify account key", 'no_matching_verify_account_key' + error_flash "The account you tried to create is currently awaiting verification", 'attempt_to_create_unverified_account' + error_flash "The account you tried to login with is currently awaiting verification", 'attempt_to_login_to_unverified_account' notice_flash "Your account has been verified" notice_flash "An email has been sent to you with a link to verify your account", 'verify_account_email_sent' loaded_templates %w'verify-account verify-account-resend verify-account-email' view 'verify-account', 'Verify Account' view 'verify-account-resend', 'Resend Verification Email', 'resend_verify_account' @@ -22,21 +29,19 @@ button 'Send Verification Email Again', 'verify_account_resend' redirect redirect(:verify_account_email_sent){default_post_email_redirect} redirect(:verify_account_email_recently_sent){default_post_email_redirect} - auth_value_method :no_matching_verify_account_key_message, "invalid verify account key" - auth_value_method :attempt_to_create_unverified_account_notice_message, "The account you tried to create is currently awaiting verification" - auth_value_method :attempt_to_login_to_unverified_account_notice_message, "The account you tried to login with is currently awaiting verification" auth_value_method :verify_account_email_subject, 'Verify Account' auth_value_method :verify_account_key_param, 'key' auth_value_method :verify_account_autologin?, true auth_value_method :verify_account_table, :account_verification_keys auth_value_method :verify_account_id_column, :id auth_value_method :verify_account_email_last_sent_column, nil auth_value_method :verify_account_skip_resend_email_within, 300 auth_value_method :verify_account_key_column, :key + auth_value_method :verify_account_resend_explanatory_text, "<p>If you no longer have the email to verify the account, you can request that it be resent to you:</p>" session_key :verify_account_session_key, :verify_account_key auth_value_method :verify_account_set_password?, false auth_methods( :allow_resending_verify_account_email?, @@ -100,11 +105,11 @@ if key = session[verify_account_session_key] if account_from_verify_account_key(key) verify_account_view else session[verify_account_session_key] = nil - set_redirect_error_flash no_matching_verify_account_key_message + set_redirect_error_flash no_matching_verify_account_key_error_flash redirect require_login_redirect end end end @@ -178,11 +183,11 @@ end def new_account(login) if account_from_login(login) && allow_resending_verify_account_email? set_redirect_error_status(unopen_account_error_status) - set_error_flash attempt_to_create_unverified_account_notice_message + set_error_flash attempt_to_create_unverified_account_error_flash response.write resend_verify_account_view request.halt end super end @@ -249,10 +254,10 @@ attr_reader :verify_account_key_value def before_login_attempt unless open_account? set_redirect_error_status(unopen_account_error_status) - set_error_flash attempt_to_login_to_unverified_account_notice_message + set_error_flash attempt_to_login_to_unverified_account_error_flash response.write resend_verify_account_view request.halt end super end