Skip to content

Conversation

@RayWangQvQ
Copy link
Owner

内容

#935

Add change password feature

image

@RayWangQvQ RayWangQvQ requested a review from Copilot June 15, 2025 17:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements the change password feature for the web admin interface and makes minor UI tweaks while updating associated project metadata.

  • Adds ChangePasswordAsync and GetAdminUserNameAsync methods in the authentication service
  • Introduces an admin page for updating password (and username) with corresponding UI and logic
  • Updates navigation components and project metadata including the changelog

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/Ray.BiliBiliTool.Web/Services/AuthService.cs Adds change password methods with potential hardcoded user handling and username update logic
src/Ray.BiliBiliTool.Web/Components/Pages/Admin.razor.cs Implements the logic for the change password page, including error handling and logout
src/Ray.BiliBiliTool.Web/Components/Pages/Admin.razor Creates the UI for change password with an input field labeled "New User Name" that may be ambiguous
src/Ray.BiliBiliTool.Web/Components/Layout/NavMenu.razor.css & .razor Adds styling and navigation for the new admin section
common.props Bumps the project version
CHANGELOG.md Updates the changelog with feature references
Comments suppressed due to low confidence (3)

src/Ray.BiliBiliTool.Web/Services/AuthService.cs:57

  • Updating the username within a change password operation can be confusing. Please clarify whether changing the username is intentional or if this operation should solely update the password.
user.Username = username;

src/Ray.BiliBiliTool.Web/Components/Pages/Admin.razor:20

  • [nitpick] The 'New User Name' label in a change password form can be misleading. Consider renaming the field to simply 'Username' or clarifying its purpose if the intent is to allow updating the username concurrently.
<MudTextField @bind-Value="_username" Label="New User Name" Required="true" RequiredError="Username cannot be empty" />

CHANGELOG.md:2

  • [nitpick] There appear to be conflicting changelog entries referencing feature ID #935 for both the change password and the login functionality. Please update the changelog to accurately reflect the changes introduced in this PR.
- Feature[#935]: Web 新增修改密码功能

Comment on lines +46 to +48
var user = await context.Users.FirstAsync(u => u.Id == 1);

if (!PasswordHelper.VerifyPassword(currentPassword, user.Salt, user.PasswordHash))
Copy link

Copilot AI Jun 15, 2025

Choose a reason for hiding this comment

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

Using a hardcoded user ID may lead to issues in multi-user environments. Consider querying the user based on the provided username or another flexible identifier.

Suggested change
var user = await context.Users.FirstAsync(u => u.Id == 1);
if (!PasswordHelper.VerifyPassword(currentPassword, user.Salt, user.PasswordHash))
var user = await context.Users.FirstOrDefaultAsync(u => u.Username == username);
if (user == null || !PasswordHelper.VerifyPassword(currentPassword, user.Salt, user.PasswordHash))

Copilot uses AI. Check for mistakes.
@RayWangQvQ RayWangQvQ merged commit 7652dc7 into develop Jun 15, 2025
2 checks passed
@RayWangQvQ RayWangQvQ deleted the feature/935-user-manage branch August 2, 2025 15:35
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.

1 participant