mirror of
https://github.com/Mibew/mibew.git
synced 2025-04-10 09:50:12 +03:00
Make operator's login unchangeable
This commit is contained in:
parent
05f5a606d1
commit
1d9a837e37
@ -94,7 +94,9 @@ class ProfileController extends AbstractController
|
|||||||
|
|
||||||
$page['stored'] = $request->query->has('stored');
|
$page['stored'] = $request->query->has('stored');
|
||||||
$page['canmodify'] = $can_modify ? '1' : '';
|
$page['canmodify'] = $can_modify ? '1' : '';
|
||||||
$page['canchangelogin'] = is_capable(CAN_ADMINISTRATE, $operator);
|
// The login cannot be changed for existing operators because it will
|
||||||
|
// make the stored password hash invalid.
|
||||||
|
$page['canchangelogin'] = is_capable(CAN_ADMINISTRATE, $operator) && !$op_id;
|
||||||
$page['title'] = getlocal('Operator details');
|
$page['title'] = getlocal('Operator details');
|
||||||
$page['menuid'] = ($op_id == $operator['operatorid']) ? 'profile' : 'operators';
|
$page['menuid'] = ($op_id == $operator['operatorid']) ? 'profile' : 'operators';
|
||||||
$page['requirePassword'] = (!$op_id);
|
$page['requirePassword'] = (!$op_id);
|
||||||
@ -141,10 +143,14 @@ class ProfileController extends AbstractController
|
|||||||
$errors[] = no_field('International name (Latin)');
|
$errors[] = no_field('International name (Latin)');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$login) {
|
// The login is needed only for new operators. If login is changed for
|
||||||
$errors[] = no_field('Login');
|
// existing operator the stored password hash becomes invalid.
|
||||||
} elseif (!preg_match("/^[\w_\.]+$/", $login)) {
|
if (!$op_id) {
|
||||||
$errors[] = getlocal('Login should contain only latin characters, numbers and underscore symbol.');
|
if (!$login) {
|
||||||
|
$errors[] = no_field('Login');
|
||||||
|
} elseif (!preg_match("/^[\w_\.]+$/", $login)) {
|
||||||
|
$errors[] = getlocal('Login should contain only latin characters, numbers and underscore symbol.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$email || !is_valid_email($email)) {
|
if (!$email || !is_valid_email($email)) {
|
||||||
@ -206,7 +212,6 @@ class ProfileController extends AbstractController
|
|||||||
|
|
||||||
// Mix old operator's fields with updated values
|
// Mix old operator's fields with updated values
|
||||||
$target_operator = array(
|
$target_operator = array(
|
||||||
'vclogin' => $login,
|
|
||||||
'vcemail' => $email,
|
'vcemail' => $email,
|
||||||
'vclocalename' => $local_name,
|
'vclocalename' => $local_name,
|
||||||
'vccommonname' => $common_name,
|
'vccommonname' => $common_name,
|
||||||
|
Loading…
Reference in New Issue
Block a user