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

Generate a login link when running the demo mode CLI #30

Merged
merged 10 commits into from
Jul 23, 2024

Conversation

rzane
Copy link
Contributor

@rzane rzane commented Jul 23, 2024

Screenshot 2024-07-23 at 8 45 44 AM

Comment on lines +49 to +57
def session_url(session)
routes = DemoMode::Engine.routes

options = routes.default_url_options.presence
options ||= ActionMailer::Base.default_url_options.presence if defined?(ActionMailer::Base)
options ||= { only_path: true }

routes.url_for(controller: 'demo_mode/sessions', action: 'show', id: session, **options)
end
Copy link
Contributor Author

@rzane rzane Jul 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a best effort approach. We try to resolve the URL in the following order:

  1. You can explicitly configure URL generation by setting DemoMode::Engine.routes.default_url_options.
  2. We'll fallback to the default_url_options you've used for config.action_mailer.default_url_options. This should work well for the majority of applications and custom configuration probably won't be necessary.
  3. We'll fallback to generating just a path.

Comment on lines +4 to +6
def email
'[email protected]'
end
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The DemoMode CLI expects the signinable to have an email, but the DummyUser in our test personas doesn't actually have an email attribute.

Copy link
Member

@smudge smudge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

domain LGTM && platform LGTM! Love this feature. 👏

@smudge smudge merged commit 9a622e0 into Betterment:main Jul 23, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants