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

Return error if the currently created user is equal to the admin user. #529

Merged
merged 2 commits into from
Jan 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
pull_request:
branches:
- 'main'
name: Lint rust

jobs:
cargolint:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
on: [pull_request]
name: Test rust

jobs:
build_and_test:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
pull_request:
paths:
- 'src/**'
name: Test rust

jobs:
build_and_test:
Expand Down
7 changes: 2 additions & 5 deletions src/gpodder/auth/authentication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,9 @@ pub async fn login(

if let Some(admin_username) = &env.username {
if admin_username == &unwrapped_username {
if let Some(admin_password) = &env.password {
if admin_password == &digest(password.clone()) {
return Ok(HttpResponse::Ok().json("Login successful"));
}
return Err(CustomError::Conflict("The user you are trying to login is equal to the admin user. Please\
use another user to login.".to_string()));
}
}
}

let user = User::find_by_username(
Expand Down
Loading