Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: harmonize examples & clarify when to use setup_activation (recommended in README but not in the Wiki) #328

Open
2 tasks
jankoegel opened this issue Nov 4, 2022 · 0 comments
Labels
documentation Improvements or additions to documentation

Comments

@jankoegel
Copy link

Configuration

  • Sorcery Version: latest

Expected Behavior

The docs should be clear and not say two different things in two places.

Actual Behavior

The README recommends the following steps to activate a user:

User.load_from_activation_token(token)
@user.setup_activation
@user.activate!

This suggests that a call to setup_activation is required to activate a user. In the Wiki, however, setup_activation is omitted (and only mentioned at the very bottom in an example for resending the activation email):

if @user = User.load_from_activation_token(params[:id])
  @user.activate!
  redirect_to(login_path, :notice => 'User was successfully activated.')

Source for setup_activation at the time of writing:

def setup_activation
config = sorcery_config
generated_activation_token = TemporaryToken.generate_random_token
send(:"#{config.activation_token_attribute_name}=", generated_activation_token)
send(:"#{config.activation_state_attribute_name}=", 'pending')
send(:"#{config.activation_token_expires_at_attribute_name}=", Time.now.in_time_zone + config.activation_token_expiration_period) if config.activation_token_expiration_period
end

Desired changes

  • clarify in the docs when a call to setup_activation is needed
  • harmonize the examples in the README and the Wiki so no confusion about when it's required to call setup_activation.

Steps to Reproduce

Doesn't apply.

@joshbuker joshbuker added the documentation Improvements or additions to documentation label Jan 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants