mirror of
				https://github.com/Mibew/i18n.git
				synced 2025-11-01 01:36:57 +03:00 
			
		
		
		
	Make operator's email unique in the system
This commit is contained in:
		
							parent
							
								
									142d9edb20
								
							
						
					
					
						commit
						827d9a0b8d
					
				| @ -347,6 +347,7 @@ page_agent.cannot_modify=You are not allowed to change this person's profile. | ||||
| page_agent.clear_avatar=Remove avatar | ||||
| page_agent.create_new=You can create a new operator here. | ||||
| page_agent.error.duplicate_login=Please choose another login because an operator with that login is already registered in the system. | ||||
| page_agent.error.duplicate_email=Please choose another email because an operator with that email is already registered in the system. | ||||
| page_agent.error.forbidden_create=You are not allowed to create operators. | ||||
| page_agent.error.wrong_login=Login should contain only latin characters, numbers and underscore symbol. | ||||
| page_agent.error.wrong_agent_code=Code should contain only latin characters, numbers and underscore symbol. | ||||
|  | ||||
| @ -347,6 +347,7 @@ page_agent.cannot_modify= | ||||
| page_agent.clear_avatar=Удалить аватарку | ||||
| page_agent.create_new=Создание нового оператора. | ||||
| page_agent.error.duplicate_login=Выберите другой логин, т.к. оператор с введенным логином уже зарегистрирован в системе. | ||||
| page_agent.error.duplicate_email=Выберите другой адрес электронной почты, т.к. оператор с введенным адресом уже зарегистрирован в системе. | ||||
| page_agent.error.forbidden_create=Вы не можете создавать операторов. | ||||
| page_agent.error.wrong_login=Логин должен состоять из латинских символов, цифр и знака подчеркивания. | ||||
| page_agent.error.wrong_agent_code=Код должен состоять из латинских символов, цифр и знака подчеркивания. | ||||
|  | ||||
| @ -71,6 +71,17 @@ if ((isset($_POST['login']) || !is_capable(CAN_ADMINISTRATE, $operator)) && isse | ||||
| 		($opId && $existing_operator && $opId != $existing_operator['operatorid'])) | ||||
| 		$errors[] = getlocal("page_agent.error.duplicate_login"); | ||||
| 
 | ||||
| 	// Check if operator with specified email already exists in the database
 | ||||
| 	$existing_operator = operator_by_email($email); | ||||
| 	if ( | ||||
| 		// Create operator with email already in database
 | ||||
| 		(!$opId && $existing_operator) || | ||||
| 		// Update operator email to existing one
 | ||||
| 		($opId && $existing_operator && $opId != $existing_operator['operatorid']) | ||||
| 	) { | ||||
| 		$errors[] = getlocal("page_agent.error.duplicate_email"); | ||||
| 	} | ||||
| 
 | ||||
| 	$canmodify = ($opId == $operator['operatorid'] && is_capable(CAN_MODIFYPROFILE, $operator)) | ||||
| 				 || is_capable(CAN_ADMINISTRATE, $operator); | ||||
| 	if (!$canmodify) { | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user