Sha256: 450d749f94ca8d2e057bfcf78090b7d684e896245cba7d2fbdbb25fcd783c341

Contents?: true

Size: 1.75 KB

Versions: 35

Compression:

Stored size: 1.75 KB

Contents

= Require account verification by admin

There are scenarios in which, instead of allowing the user to verify they have
access to the email for the account, you may want to have an admin or moderator
approve new accounts manually. One way this can be achieved by sending the
account verification email to the admin:

  plugin :rodauth do
    enable :login, :logout, :verify_account, :reset_password

    # Send account verification email to the admin
    email_to do
      if account[account_status_column] == account_unverified_status_value
        "admin@myapp.com"
      else
        super()
      end
    end

    # Do not ask for password when creating or verifying account
    verify_account_set_password? false
    create_account_set_password? false

    # Adjust the account verification email subject and body
    verify_account_email_subject "New User Awaiting Admin Approval"
    verify_account_email_body do
      "The user #{account[login_column]} has created an account. Click here to approve it: #{verify_account_email_link}."
    end

    # Display this message to the user after they've created their account
    verify_account_email_sent_notice_flash "Your account has been created and is awaiting approval"

    # Prevent the admin from being logged in after confirming the account
    verify_account_autologin? false
    verify_account_notice_flash "The account has been approved"

    # Send a reset password email after verifying the account.
    # This allows the user to choose the password for the account,
    # and also makes sure the user can only log in if they have
    # access to the email address for the account.
    after_verify_account do
      generate_reset_password_key_value
      create_reset_password_key
      send_reset_password_email
    end
  end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
rodauth-2.36.0 doc/guides/admin_activation.rdoc
rodauth-2.34.0 doc/guides/admin_activation.rdoc
rodauth-2.33.0 doc/guides/admin_activation.rdoc
rodauth-2.32.0 doc/guides/admin_activation.rdoc
rodauth-2.31.0 doc/guides/admin_activation.rdoc
rodauth-2.30.0 doc/guides/admin_activation.rdoc
rodauth-2.29.0 doc/guides/admin_activation.rdoc
rodauth-2.28.0 doc/guides/admin_activation.rdoc
rodauth-2.27.0 doc/guides/admin_activation.rdoc
rodauth-2.26.1 doc/guides/admin_activation.rdoc
rodauth-2.26.0 doc/guides/admin_activation.rdoc
rodauth-2.25.0 doc/guides/admin_activation.rdoc
rodauth-2.24.0 doc/guides/admin_activation.rdoc
rodauth-2.23.0 doc/guides/admin_activation.rdoc
rodauth-2.22.0 doc/guides/admin_activation.rdoc
rodauth-2.21.0 doc/guides/admin_activation.rdoc
rodauth-2.20.0 doc/guides/admin_activation.rdoc
rodauth-2.19.0 doc/guides/admin_activation.rdoc
rodauth-2.18.0 doc/guides/admin_activation.rdoc
rodauth-2.17.0 doc/guides/admin_activation.rdoc