This commit is contained in:
René Gieling 2021-09-12 21:32:50 +02:00 коммит произвёл GitHub
Родитель dae0b08141
Коммит 69dfc240bb
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 16 добавлений и 34 удалений

Просмотреть файл

@ -135,17 +135,16 @@ class SystemService {
public function validatePublicUsername(string $userName, string $token): bool {
$share = $this->shareMapper->findByToken($token);
if (!$userName) {
throw new TooShortException('Username must not be empty');
}
if ($share->getDisplayName() === $userName) {
return true;
}
$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
foreach (Group::search() as $group) {
if ($userName === strtolower(trim($group->getId()))

Просмотреть файл

@ -144,11 +144,6 @@ export default {
result: t('polls', 'Enter a name to participate.'),
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) {
return {
result: t('polls', 'Invalid name'),
@ -191,7 +186,7 @@ export default {
watch: {
userName() {
if (this.userName.length > 2) {
if (this.userName) {
this.checkingUserName = true
if (this.userName !== this.share.userid) {
this.validatePublicUsername()
@ -203,7 +198,7 @@ export default {
},
emailAddress() {
if (this.emailAddress.length > 0) {
if (this.emailAddress) {
this.checkingEmailAddress = true
this.validateEmailAddress()
} else {
@ -236,35 +231,23 @@ export default {
},
validatePublicUsername: debounce(async function() {
if (this.userName.length > 2) {
try {
await axios.post(generateUrl('apps/polls/check/username'), { userName: this.userName, token: this.$route.params.token })
this.checkingUserName = false
this.isValidName = true
} catch {
this.checkingUserName = false
this.isValidName = false
}
} else {
this.checkingUserName = false
this.isValidName = false
}
}, 500),
validateEmailAddress: debounce(async function() {
if (this.emailAddress.length > 0) {
try {
await axios.get(generateUrl('apps/polls/check/emailaddress') + '/' + this.emailAddress)
this.isValidEmailAddress = true
this.checkingEmailAddress = false
} catch {
this.isValidEmailAddress = false
this.checkingEmailAddress = false
}
} else {
this.isValidEmailAddress = false
this.checkingEmailAddress = false
}
}, 500),
async submitRegistration() {