From 393a3e3be0d2ea605d49e3dc9f0a4b2a23555d2e Mon Sep 17 00:00:00 2001 From: live77 <535157110@qq.com> Date: Sat, 27 Nov 2021 13:10:08 +0800 Subject: [PATCH] add comment for password pattern explaination. --- staging/src/kubesphere.io/api/iam/v1alpha2/types.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/staging/src/kubesphere.io/api/iam/v1alpha2/types.go b/staging/src/kubesphere.io/api/iam/v1alpha2/types.go index fba79c779..7a22797a1 100644 --- a/staging/src/kubesphere.io/api/iam/v1alpha2/types.go +++ b/staging/src/kubesphere.io/api/iam/v1alpha2/types.go @@ -135,8 +135,13 @@ type UserSpec struct { // But in Go, we don't have ?= (back tracking) capability in regexp (also in CRD validation pattern) // So we adopted an alternative scheme to achieve. // Use 6 different regexp to combine to achieve the same effect. - // These six schemes enumerate the arrangement of numbers, uppercase letters, and lowercase letters - // that appear for the first time. + // These six schemes enumerate the arrangement of numbers, uppercase letters, and lowercase letters that appear for the first time. + // - ^(.*[a-z].*[A-Z].*[0-9].*)$ stands for lowercase letter comes first, then followed by an uppercase letter, then a digit. + // - ^(.*[a-z].*[0-9].*[A-Z].*)$ stands for lowercase letter comes first, then followed by a digit, then an uppercase leeter. + // - ^(.*[A-Z].*[a-z].*[0-9].*)$ ... + // - ^(.*[A-Z].*[0-9].*[a-z].*)$ ... + // - ^(.*[0-9].*[a-z].*[A-Z].*)$ ... + // - ^(.*[0-9].*[A-Z].*[a-z].*)$ ... // Last but not least, the bcrypt string is also included to match the encrypted password. ^(\$2[ayb]\$.{56})$ EncryptedPassword string `json:"password,omitempty"` }