mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge remote-tracking branch 'origin/as-validate-email-length'
GitOrigin-RevId: 00f46c637a7563443e903f491ec39446dc570b5f
This commit is contained in:
parent
9a0dd31d8c
commit
dc60d6b630
2 changed files with 6 additions and 2 deletions
|
@ -4,6 +4,7 @@ module.exports = EmailHelper =
|
|||
|
||||
parseEmail: (email) ->
|
||||
return null unless email?
|
||||
return null if email.length > 254
|
||||
email = email.trim().toLowerCase()
|
||||
|
||||
matched = email.match EMAIL_REGEXP
|
||||
|
|
|
@ -6,10 +6,13 @@ uuid = require('uuid')
|
|||
Schema = mongoose.Schema
|
||||
ObjectId = Schema.ObjectId
|
||||
|
||||
# See https://stackoverflow.com/questions/386294/what-is-the-maximum-length-of-a-valid-email-address/574698#574698
|
||||
MAX_EMAIL_LENGTH = 254
|
||||
|
||||
UserSchema = new Schema
|
||||
email : {type : String, default : ''}
|
||||
email : {type : String, default : '', maxlength: MAX_EMAIL_LENGTH }
|
||||
emails: [{
|
||||
email: { type : String, default : '' },
|
||||
email: { type : String, default : '', maxlength: MAX_EMAIL_LENGTH },
|
||||
reversedHostname: { type : String, default : '' },
|
||||
createdAt: { type : Date, default: () -> new Date() },
|
||||
confirmedAt: { type: Date }
|
||||
|
|
Loading…
Reference in a new issue