feat: 限制学生账号不能包含中文
This commit is contained in:
parent
23ab42b371
commit
398f93dd9e
@ -97,6 +97,10 @@ class StudentController extends Crud
|
|||||||
|
|
||||||
$request_data = $request->post();
|
$request_data = $request->post();
|
||||||
$salt = random_str(16);
|
$salt = random_str(16);
|
||||||
|
|
||||||
|
if (check_chinese_chars($request_data['account'])){
|
||||||
|
throw new Exception('账号中不能包含中文');
|
||||||
|
}
|
||||||
if (empty($request_data['password'])) {
|
if (empty($request_data['password'])) {
|
||||||
$password = trim(explode(' ', $request_data['account'])[0]) . '001';
|
$password = trim(explode(' ', $request_data['account'])[0]) . '001';
|
||||||
$password = md5($password . $salt);
|
$password = md5($password . $salt);
|
||||||
@ -141,8 +145,8 @@ class StudentController extends Crud
|
|||||||
throw new Exception('未找到学生信息,操作失败');
|
throw new Exception('未找到学生信息,操作失败');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (check_chinese_chars($request_data['student_name'])){
|
if (check_chinese_chars($request_data['account'])){
|
||||||
throw new Exception('名字中不能包含中文');
|
throw new Exception('账号中不能包含中文');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($request_data['password'])) {
|
if (empty($request_data['password'])) {
|
||||||
@ -385,8 +389,8 @@ class StudentController extends Crud
|
|||||||
$account = trim($currSheet->getCell('A' . $row)->getValue() ?: '');
|
$account = trim($currSheet->getCell('A' . $row)->getValue() ?: '');
|
||||||
$student_name = trim($currSheet->getCell('B' . $row)->getValue() ?: '');
|
$student_name = trim($currSheet->getCell('B' . $row)->getValue() ?: '');
|
||||||
|
|
||||||
if(check_chinese_chars($student_name)){
|
if(check_chinese_chars($account)){
|
||||||
$check_msg .= '【'+ $student_name +'】';
|
$check_msg .= '【'+ $account +'】';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($account && $student_name) {
|
if ($account && $student_name) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user