feat: 限制学生账号不能包含中文

This commit is contained in:
Dai 2025-01-18 15:09:03 +08:00
parent 23ab42b371
commit 398f93dd9e

View File

@ -97,6 +97,10 @@ class StudentController extends Crud
$request_data = $request->post();
$salt = random_str(16);
if (check_chinese_chars($request_data['account'])){
throw new Exception('账号中不能包含中文');
}
if (empty($request_data['password'])) {
$password = trim(explode(' ', $request_data['account'])[0]) . '001';
$password = md5($password . $salt);
@ -141,8 +145,8 @@ class StudentController extends Crud
throw new Exception('未找到学生信息,操作失败');
}
if (check_chinese_chars($request_data['student_name'])){
throw new Exception('名字中不能包含中文');
if (check_chinese_chars($request_data['account'])){
throw new Exception('账号中不能包含中文');
}
if (empty($request_data['password'])) {
@ -385,8 +389,8 @@ class StudentController extends Crud
$account = trim($currSheet->getCell('A' . $row)->getValue() ?: '');
$student_name = trim($currSheet->getCell('B' . $row)->getValue() ?: '');
if(check_chinese_chars($student_name)){
$check_msg .= '【'+ $student_name +'】';
if(check_chinese_chars($account)){
$check_msg .= '【'+ $account +'】';
}
if ($account && $student_name) {