fix(auth): reject placeholder mobile numbers
This commit is contained in:
@@ -23,14 +23,14 @@ BEGIN
|
||||
IF EXISTS (
|
||||
SELECT user.phone
|
||||
FROM baiyue_iam.iam_user user
|
||||
WHERE user.deleted = 0 AND user.phone REGEXP '^1[0-9]{10}$'
|
||||
WHERE user.deleted = 0 AND user.phone REGEXP '^1[3-9][0-9]{9}$'
|
||||
GROUP BY user.phone HAVING COUNT(DISTINCT user.auth_user_id) > 1) THEN
|
||||
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'IAM 存在重复手机号,禁止建立 Auth 唯一登录索引';
|
||||
END IF;
|
||||
UPDATE auth_account account
|
||||
JOIN baiyue_iam.iam_user user ON user.auth_user_id = account.id AND user.deleted = 0
|
||||
SET account.phone = user.phone
|
||||
WHERE account.phone IS NULL AND user.phone REGEXP '^1[0-9]{10}$';
|
||||
WHERE account.phone IS NULL AND user.phone REGEXP '^1[3-9][0-9]{9}$';
|
||||
IF NOT EXISTS (
|
||||
SELECT 1 FROM information_schema.statistics
|
||||
WHERE table_schema = 'baiyue_auth' AND table_name = 'auth_account'
|
||||
|
||||
Reference in New Issue
Block a user