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
Allow keyless guests #606
Conversation
if key.nil? | ||
u = User.find_by_login('guestuser') | ||
else | ||
u = User.find_by_apikey(params[:key]) || User.find_by_login('guestuser') |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better?
…est user account.
|
||
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]) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Implements feature requested in Issue #605.