Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
services
Archive
t3o
my.typo3.org
Commits
60eb44fa
Commit
60eb44fa
authored
Apr 10, 2018
by
Thomas Löffler
Browse files
Prevent user to register a username which was taken and not in LDAP
parent
079bcb4c
Pipeline
#4142
passed with stages
in 4 minutes and 20 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
html/typo3conf/ext/t3omy/Classes/Domain/Validator/ServersideValidator.php
View file @
60eb44fa
...
...
@@ -69,6 +69,10 @@ class ServersideValidator extends \In2code\Femanager\Domain\Validator\Serverside
$this
->
checkUniqueInLdapValidation
(
$user
,
$value
,
$validationSetting
,
$fieldName
);
break
;
case
'notInOldUserTable'
:
$this
->
notInOldUserTableValidation
(
$user
,
$value
,
$validationSetting
,
$fieldName
);
break
;
case
'mustInclude'
:
$this
->
checkMustIncludeValidation
(
$value
,
$validationSetting
,
$fieldName
);
break
;
...
...
@@ -114,9 +118,35 @@ class ServersideValidator extends \In2code\Femanager\Domain\Validator\Serverside
{
$ldap
=
\
TYPO3\CMS\Core\Utility\GeneralUtility
::
makeInstance
(
\
T3o\T3oLdap\Connectors\Ldap
::
class
);
if
(
$ldap
->
userExists
(
$value
))
{
$this
->
addError
(
ucfirst
(
$fieldName
)
.
' is
already in use (LDAP)
'
,
$fieldName
);
$this
->
addError
(
ucfirst
(
$fieldName
)
.
' is
not available.
'
,
$fieldName
);
$this
->
isValid
=
false
;
}
}
/**
* @param \In2code\Femanager\Domain\Model\User $user
* @param $value
* @param $validationSettings
* @param $fieldName
* @return void
*/
protected
function
notInOldUserTableValidation
(
$user
,
$value
,
$validationSettings
,
$fieldName
)
{
$queryBuilder
=
\
TYPO3\CMS\Core\Utility\GeneralUtility
::
makeInstance
(
\
TYPO3\CMS\Core\Database\ConnectionPool
::
class
)
->
getQueryBuilderForTable
(
'old_users'
);
$usernameExists
=
(
bool
)
$queryBuilder
->
count
(
'*'
)
->
from
(
'old_users'
)
->
where
(
$queryBuilder
->
expr
()
->
eq
(
'username'
,
$queryBuilder
->
createNamedParameter
(
$value
,
\
PDO
::
PARAM_STR
)
)
)
->
execute
()
->
fetchColumn
(
0
);
if
(
$usernameExists
)
{
$this
->
addError
(
ucfirst
(
$fieldName
)
.
' is not available.'
,
$fieldName
);
$this
->
isValid
=
false
;
}
}
}
html/typo3conf/ext/t3omy/Configuration/TypoScript/femanager.txt
View file @
60eb44fa
...
...
@@ -13,6 +13,7 @@ plugin.tx_femanager {
username {
uniqueInDb = 0
uniqueInLdap = 1
notInOldUserTable = 1
}
password {
min = 12
...
...
html/typo3conf/ext/t3omy/ext_tables.sql
View file @
60eb44fa
...
...
@@ -7,3 +7,9 @@ CREATE TABLE fe_users (
facebook
VARCHAR
(
255
),
terms_version
VARCHAR
(
255
)
);
CREATE
TABLE
old_users
(
uid
int
(
11
)
unsigned
DEFAULT
'0'
,
username
varchar
(
255
)
DEFAULT
''
,
email
varchar
(
255
)
DEFAULT
''
);
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment