remove 3 character rule (#1953)
This commit is contained in:
Родитель
dae0b08141
Коммит
69dfc240bb
|
@ -135,17 +135,16 @@ class SystemService {
|
||||||
public function validatePublicUsername(string $userName, string $token): bool {
|
public function validatePublicUsername(string $userName, string $token): bool {
|
||||||
$share = $this->shareMapper->findByToken($token);
|
$share = $this->shareMapper->findByToken($token);
|
||||||
|
|
||||||
|
if (!$userName) {
|
||||||
|
throw new TooShortException('Username must not be empty');
|
||||||
|
}
|
||||||
|
|
||||||
if ($share->getDisplayName() === $userName) {
|
if ($share->getDisplayName() === $userName) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$userName = strtolower(trim($userName));
|
$userName = strtolower(trim($userName));
|
||||||
|
|
||||||
// return forbidden, if the length of the userame is lower than 3 characters
|
|
||||||
if (strlen($userName) < 3) {
|
|
||||||
throw new TooShortException('Username must have at least 3 characters');
|
|
||||||
}
|
|
||||||
|
|
||||||
// get all groups
|
// get all groups
|
||||||
foreach (Group::search() as $group) {
|
foreach (Group::search() as $group) {
|
||||||
if ($userName === strtolower(trim($group->getId()))
|
if ($userName === strtolower(trim($group->getId()))
|
||||||
|
|
|
@ -144,11 +144,6 @@ export default {
|
||||||
result: t('polls', 'Enter a name to participate.'),
|
result: t('polls', 'Enter a name to participate.'),
|
||||||
status: 'empty',
|
status: 'empty',
|
||||||
}
|
}
|
||||||
} else if (this.userName.length < 3) {
|
|
||||||
return {
|
|
||||||
result: t('polls', 'Name must be at least 3 characters.'),
|
|
||||||
status: 'error',
|
|
||||||
}
|
|
||||||
} else if (!this.isValidName) {
|
} else if (!this.isValidName) {
|
||||||
return {
|
return {
|
||||||
result: t('polls', 'Invalid name'),
|
result: t('polls', 'Invalid name'),
|
||||||
|
@ -191,7 +186,7 @@ export default {
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
userName() {
|
userName() {
|
||||||
if (this.userName.length > 2) {
|
if (this.userName) {
|
||||||
this.checkingUserName = true
|
this.checkingUserName = true
|
||||||
if (this.userName !== this.share.userid) {
|
if (this.userName !== this.share.userid) {
|
||||||
this.validatePublicUsername()
|
this.validatePublicUsername()
|
||||||
|
@ -203,7 +198,7 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
emailAddress() {
|
emailAddress() {
|
||||||
if (this.emailAddress.length > 0) {
|
if (this.emailAddress) {
|
||||||
this.checkingEmailAddress = true
|
this.checkingEmailAddress = true
|
||||||
this.validateEmailAddress()
|
this.validateEmailAddress()
|
||||||
} else {
|
} else {
|
||||||
|
@ -236,35 +231,23 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
validatePublicUsername: debounce(async function() {
|
validatePublicUsername: debounce(async function() {
|
||||||
if (this.userName.length > 2) {
|
|
||||||
try {
|
try {
|
||||||
await axios.post(generateUrl('apps/polls/check/username'), { userName: this.userName, token: this.$route.params.token })
|
await axios.post(generateUrl('apps/polls/check/username'), { userName: this.userName, token: this.$route.params.token })
|
||||||
this.checkingUserName = false
|
|
||||||
this.isValidName = true
|
this.isValidName = true
|
||||||
} catch {
|
} catch {
|
||||||
this.checkingUserName = false
|
|
||||||
this.isValidName = false
|
this.isValidName = false
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
this.checkingUserName = false
|
this.checkingUserName = false
|
||||||
this.isValidName = false
|
|
||||||
}
|
|
||||||
}, 500),
|
}, 500),
|
||||||
|
|
||||||
validateEmailAddress: debounce(async function() {
|
validateEmailAddress: debounce(async function() {
|
||||||
if (this.emailAddress.length > 0) {
|
|
||||||
try {
|
try {
|
||||||
await axios.get(generateUrl('apps/polls/check/emailaddress') + '/' + this.emailAddress)
|
await axios.get(generateUrl('apps/polls/check/emailaddress') + '/' + this.emailAddress)
|
||||||
this.isValidEmailAddress = true
|
this.isValidEmailAddress = true
|
||||||
this.checkingEmailAddress = false
|
|
||||||
} catch {
|
} catch {
|
||||||
this.isValidEmailAddress = false
|
this.isValidEmailAddress = false
|
||||||
this.checkingEmailAddress = false
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
this.isValidEmailAddress = false
|
|
||||||
this.checkingEmailAddress = false
|
this.checkingEmailAddress = false
|
||||||
}
|
|
||||||
}, 500),
|
}, 500),
|
||||||
|
|
||||||
async submitRegistration() {
|
async submitRegistration() {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче