Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ defineExpose({ open })
</div>
<div class="flex-align-center gap-2">
<span class="shrink-0">登录失败</span>
<el-input-number v-model="authForm.failed_attempts" class="w-32!" :min="1" :max="100" :precision="0" :value-on-clear="5" />
<el-input-number v-model="authForm.failed_attempts" class="w-32!" :min="-1" :max="100" :precision="0" :value-on-clear="5" />
<span class="shrink-0">次,锁定账号</span>
<el-input-number v-model="authForm.lock_time" class="w-32!" :min="1" :max="1440" :precision="0" :value-on-clear="10" />
<span class="shrink-0">分钟</span>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Here is a concise review of the code change:

Issue: Logical/Security Flaw

  • min="-1" allows negative values: failed_attempts represents a count of failures. Allowing -1 (or any negative number) is meaningless and logically incorrect for this field. It could lead to unexpected behavior in backend logic (e.g., if the system checks attempts >= threshold, a negative value might bypass lockouts incorrectly or cause calculation errors).

Recommendation:

  • Revert to :min="0" (or 1 if zero failures shouldn't be stored). Negative values are not valid for a "failure counter."
  • If the intent was to allow clearing/resetting via the UI, use value-on-clear appropriately, but keep min non-negative.

Additional Suggestion:

  • Ensure the UI text ("Login failed... times") clearly indicates that this is a threshold for locking account, not the current attempt count. If it's the threshold, min="1" is safer because locking after 0 failures makes no sense.

Expand Down
Loading