我注意到有人设法在Django创建的网站中用一封电子邮件Foo@example.com和两次注册foo@example.com。
根据文档,我检查了代码,发现其中有一个BaseUserManager名为的类方法normalize_email,...
Normalizes the email address by lowercasing the domain part of it.
Run Code Online (Sandbox Code Playgroud)
I understand that the email address may be something like JaneDoe@example.com and if the part preceding @ is transformed too it would omit the distinction between the first and last name. Yet the problem described above rises. Why doesn't it non-case-sensitively check uniqueness of the email addresses later? Does it have a reasonable explanation or is it a bug that has to be reported and fixed?
根据RFC 5322中的规范,本地部分区分大小写,而域部分不区分大小写。这意味着Foo@example.com和foo@example.com实际上是不同的地址,而foo@Example.com和foo@example.com是相同的。
但是,每个电子邮件服务都可以根据需要免费实现本地寻址。许多电子邮件服务选择将本地部分视为不区分大小写。某些电子邮件服务(例如Gmail)选择仅将可选+符号之前的部分解释为您的实际邮件地址。然后可以使用后缀来对您的邮件进行排序,例如,所有要foo+stackoverflow@example.com发送到的邮件都可以传递foo@example.com到一个stackoverflow文件夹并可以被分类到一个文件夹中。从技术上讲,这些都是不同的地址,但是电子邮件服务会将它们解释为相同的地址。
Django遵循RFC,因此只有在保证根据规范指向相同地址时才对地址进行规范化。
| 归档时间: |
|
| 查看次数: |
103 次 |
| 最近记录: |