Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
First of all, I have to mention that I'm a beginner at open-issue...
Related issue:#57
My thought
To implement the functionality of resetting a counter to zero and effectively prevent malicious resetting, I introduced an authorization mechanism. The detailed idea is as follows:
While it's easy to simply add a button to reset the counter to zero, the key challenge lies in effectively preventing malicious users from resetting others' counters. To address this, I have assigned a unique password to each counter name and added a password modification function.
For newly created counter names, the default password is set to an empty string. When users need to modify the password, if the name has never been assigned a password before, they can directly modify the password or reset the counter without entering the old password.
However, I'm not sure if this design is truly necessary, or if there might be a more reasonable design to solve this problem.
Result
Note: This pull request has modifies the database structure by introducing a new password field.