Merge branch 'master' of github.com:nodemailer/wildduck

This commit is contained in:
Andris Reinman 2023-03-30 09:52:11 +03:00
commit ea86747ce1
No known key found for this signature in database
GPG key ID: DC6C83F4D584D364

View file

@ -554,7 +554,7 @@ module.exports = (db, server, userHandler, settingsHandler) => {
const schema = Joi.object().keys({
username: Joi.string()
.lowercase()
.regex(/^[a-z0-9][a-z0-9.]+[a-z0-9]$/, 'username')
.regex(/^[\x21-\x7e]{1,128}?$/, 'username')
.min(3)
.max(32)
.required(),
@ -583,9 +583,21 @@ module.exports = (db, server, userHandler, settingsHandler) => {
let userData;
try {
let unameview = ''
if(username.includes("@")){
unameview = tools.normalizeAddress(username, false, {
removeLabel: true,
removeDots: true
})
}
else{
unameview = username.replace(/\./g, '')
}
userData = await db.users.collection('users').findOne(
{
unameview: username.replace(/\./g, '')
unameview
},
{
projection: {