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

Allow keyless guests #606

Merged
merged 6 commits into from Nov 28, 2018
Merged

Allow keyless guests #606

merged 6 commits into from Nov 28, 2018

Conversation

gsrohde
Copy link
Contributor

@gsrohde gsrohde commented Nov 26, 2018

Implements feature requested in Issue #605.

if key.nil?
u = User.find_by_login('guestuser')
else
u = User.find_by_apikey(params[:key]) || User.find_by_login('guestuser')
Copy link
Member

Choose a reason for hiding this comment

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

If a key is given and it is wrong, I think it should return an error that states it is an invalid login. Otherwise the user might be confused why their login does not allow them to do certain actions in case the API is wrong (since it becomes guestuser).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Better?


if u.nil?
@errors = "You must either use a valid API key or set up the guest user account."
u = User.find_by_apikey(params[:key])
Copy link
Member

Choose a reason for hiding this comment

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

nitpicking but can use key variable here to prevent an extra lookup.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No problem--that was my intention but then I forgot to; and your nitpicking led me to notice and fix a more serious problem.

@gsrohde gsrohde merged commit d8693a9 into develop Nov 28, 2018
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.

None yet

3 participants