mirror of
https://github.com/nodemailer/wildduck.git
synced 2024-11-10 17:47:07 +08:00
Merge branch 'master' of github.com:nodemailer/wildduck
This commit is contained in:
commit
ea86747ce1
1 changed files with 14 additions and 2 deletions
|
@ -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: {
|
||||
|
|
Loading…
Reference in a new issue