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

Simplify authenticate_user() function #3328

Merged
merged 5 commits into from
Mar 3, 2021

Conversation

Turbo87
Copy link
Member

@Turbo87 Turbo87 commented Feb 25, 2021

The function was a bit hard to read and difficult to extend (see #3307). This PR simplifies it a little bit by returning early if a suitable authentication method was found.

r? @jtgeibel

@Turbo87 Turbo87 added C-internal 🔧 Category: Nonessential work that would make the codebase more consistent or clear A-backend ⚙️ labels Feb 25, 2021
@Turbo87 Turbo87 force-pushed the authenticate-user branch 5 times, most recently from 0261b1a to 8a4e647 Compare March 1, 2021 19:28
Turbo87 added 5 commits March 1, 2021 22:51
There is no need for us to convert the header value to a `String` here when `ApiToken::find_by_api_token()` only needs a `&str`
This allows us to give more precise error messages and enables further simplification
@Turbo87 Turbo87 force-pushed the authenticate-user branch from 8a4e647 to 9680a62 Compare March 1, 2021 21:51
Copy link
Member

@JohnTitor JohnTitor left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@Turbo87
Copy link
Member Author

Turbo87 commented Mar 3, 2021

@bors r=JohnTitor

@bors
Copy link
Contributor

bors commented Mar 3, 2021

📌 Commit 9680a62 has been approved by JohnTitor

@bors
Copy link
Contributor

bors commented Mar 3, 2021

⌛ Testing commit 9680a62 with merge 5e17d5e...

@bors
Copy link
Contributor

bors commented Mar 3, 2021

☀️ Test successful - checks-actions
Approved by: JohnTitor
Pushing 5e17d5e to master...

@bors bors merged commit 5e17d5e into rust-lang:master Mar 3, 2021
@Turbo87 Turbo87 deleted the authenticate-user branch March 3, 2021 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-backend ⚙️ C-internal 🔧 Category: Nonessential work that would make the codebase more consistent or clear
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants