Actions
Bug #27440
closedTask center - sys_action: Prefix added to username over and over again when editing BE-User
Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2011-06-14
Due date:
% Done:
100%
Estimated time:
TYPO3 Version:
4.4
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:
Description
Since TYPO3 4.4 it is necessary to remove the prefix from a username if the BE-User is beeing edited through the task center - sys-action interface. Otherwise the prefix is added again to the already prefixed username.
In TYPO3 4.3 this problem was handled by the fixUsername method. It checked if the username began with the prefix and removed it with preg_replace before saving:
function fixUsername($username,$prefix) { $username=trim($username); $prefix=trim($prefix); $username=preg_replace('/^'.quotemeta($prefix).'/','',$username); if ($username) { return $prefix.$username; } else return false; }
Since TYPO3 4.4 the fixUsername method is simplified to this:
private function fixUsername($username, $prefix) { return trim($prefix) . trim($username); }
Is there any good reason for this oversimplification?
If not, it would make sense to me to switch back to the old TYPO3 4.3 version of this method. Maybe with a small modification to allow prefix and username to be the same:
private function fixUsername($username, $prefix) { $username=trim($username); $prefix=trim($prefix); if($username !== $prefix){ $username=preg_replace('/^'.quotemeta($prefix).'/','',$username); } if ($username) { return $prefix.$username; } else { return false; }
Actions