Skip to content

Add configurable password validation rules to user profiles#8289

Draft
Copilot wants to merge 5 commits into3.0from
copilot/add-password-policy-rules
Draft

Add configurable password validation rules to user profiles#8289
Copilot wants to merge 5 commits into3.0from
copilot/add-password-policy-rules

Conversation

Copy link
Contributor

Copilot AI commented Jan 13, 2026

Implements configurable password policies per user profile (简档), allowing administrators to enforce password complexity requirements like minimum length, character types (uppercase, lowercase, numbers, special characters), and maximum length.

Changes

Schema & Database

  • Added 6 password policy fields to permission_set object: password_min_length, password_max_length, password_require_uppercase, password_require_lowercase, password_require_number, password_require_special_character
  • Updated profile schema with corresponding field definitions
  • Added zh-CN and en translations

Server-Side Validation

  • Created UserProfilePolicy interface for type safety
  • Implemented validatePasswordPolicy() method enforcing profile-specific rules in changePassword() and resetPassword() flows
  • Extended getUserProfile() to fetch password policies from user's profile with NaN protection on numeric conversions
  • Extracted SPECIAL_CHAR_PATTERN and DEFAULT_PASSWORD_POLICY constants to shared types

Client-Side & API

  • Enhanced validatePassword() function to support structured policy fields while maintaining backward compatibility with regex-based policies
  • Modified /api/accounts/settings endpoint to merge user-specific password policies when authenticated

Example Configuration

Profile with strict password requirements:

password_min_length: 12
password_max_length: 128
password_require_uppercase: true
password_require_lowercase: true
password_require_number: true
password_require_special_character: true

Validation errors returned to users:

密码长度不能少于 12 个字符
密码必须包含至少一个大写字母(A-Z)
密码必须包含至少一个特殊字符(如 !@#$%^&* 等)

Default values (min: 8, max: 128, all requirements: false) ensure existing profiles work without changes.

Original prompt

This section details on the original issue you should resolve

<issue_title>[Feature]: 平台用户密码支持配置规则</issue_title>
<issue_description>### Summary 摘要

如:位数、大小写、字符等限制;可参考2.7密码验证规则

Why should this be worked on? 此需求的应用场景?

新增功能</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 4 commits January 13, 2026 09:00
Co-authored-by: lizheng-steedos <151509384+lizheng-steedos@users.noreply.github.com>
…licies

Co-authored-by: lizheng-steedos <151509384+lizheng-steedos@users.noreply.github.com>
… quality

Co-authored-by: lizheng-steedos <151509384+lizheng-steedos@users.noreply.github.com>
Co-authored-by: lizheng-steedos <151509384+lizheng-steedos@users.noreply.github.com>
Copilot AI changed the title [WIP] Add configurable password policy rules for platform users Add configurable password validation rules to user profiles Jan 13, 2026
Copilot AI requested a review from lizheng-steedos January 13, 2026 09:13
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.

[Feature]: 平台用户密码支持配置规则

2 participants