Skip to content

Commit

Permalink
Merge pull request #4267 from FlowFuse/username-validation
Browse files Browse the repository at this point in the history
Allow Uppercase letters in initial admin username
  • Loading branch information
hardillb authored Jul 29, 2024
2 parents 0d6d61d + 180db82 commit 0ac9eba
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion forge/routes/setup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ module.exports = async function (app) {
reply.code(404).send()
return
}
if (/^(admin|root)$/.test(request.body.username) || !/^[a-z0-9-_]+$/.test(request.body.username)) {
if (/^(admin|root)$/.test(request.body.username) || !/^[a-z0-9-_]+$/i.test(request.body.username)) {
reply.code(400).send({ error: 'invalid username' })
return
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/setup/CreateAdminUser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export default {
watch: {
'input.username': function (v) {
if (v && !/^[a-z0-9-_]+$/i.test(v)) {
this.errors.username = 'Must only contain a-z 0-9 - _'
this.errors.username = 'Must only contain a-z A-Z 0-9 - _'
} else {
this.errors.username = ''
}
Expand Down

0 comments on commit 0ac9eba

Please sign in to comment.