You've already forked Mailu
							
							
				mirror of
				https://github.com/Mailu/Mailu.git
				synced 2025-10-30 23:37:43 +02:00 
			
		
		
		
	Make users and aliases email case insensitive
This commit is contained in:
		| @@ -149,7 +149,7 @@ class Email(object): | ||||
|             context.current_parameters["localpart"], | ||||
|             context.current_parameters["domain_name"], | ||||
|         ) | ||||
|         return db.Column(db.String(255), | ||||
|         return db.Column(db.String(255, collation="NOCASE"), | ||||
|             primary_key=True, nullable=False, | ||||
|             default=updater) | ||||
|  | ||||
| @@ -193,9 +193,9 @@ class User(Base, Email): | ||||
|     def get_id(self): | ||||
|         return self.email | ||||
|  | ||||
|     scheme_dict = {'SHA512-CRYPT': "sha512_crypt",  | ||||
|                    'SHA256-CRYPT': "sha256_crypt",  | ||||
|                    'MD5-CRYPT': "md5_crypt",  | ||||
|     scheme_dict = {'SHA512-CRYPT': "sha512_crypt", | ||||
|                    'SHA256-CRYPT': "sha256_crypt", | ||||
|                    'MD5-CRYPT': "md5_crypt", | ||||
|                    'CRYPT': "des_crypt"} | ||||
|     pw_context = context.CryptContext( | ||||
|         schemes = scheme_dict.values(), | ||||
|   | ||||
							
								
								
									
										28
									
								
								admin/migrations/versions/9c28df23f77e_.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								admin/migrations/versions/9c28df23f77e_.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,28 @@ | ||||
| """ Set the nocase collation on the user and alias tables | ||||
|  | ||||
| Revision ID: 9c28df23f77e | ||||
| Revises: c162ac88012a | ||||
| Create Date: 2017-10-29 13:28:29.155754 | ||||
|  | ||||
| """ | ||||
|  | ||||
| # revision identifiers, used by Alembic. | ||||
| revision = '9c28df23f77e' | ||||
| down_revision = 'c162ac88012a' | ||||
|  | ||||
| from alembic import op | ||||
| import sqlalchemy as sa | ||||
|  | ||||
|  | ||||
| def upgrade(): | ||||
|     with op.batch_alter_table('user') as batch: | ||||
|         batch.alter_column('email', type_=sa.String(length=255, collation="NOCASE")) | ||||
|     with op.batch_alter_table('alias') as batch: | ||||
|         batch.alter_column('email', type_=sa.String(length=255, collation="NOCASE")) | ||||
|  | ||||
|  | ||||
| def downgrade(): | ||||
|     with op.batch_alter_table('user') as batch: | ||||
|         batch.alter_column('email', type_=sa.String(length=255)) | ||||
|     with op.batch_alter_table('alias') as batch: | ||||
|         batch.alter_column('email', type_=sa.String(length=255)) | ||||
		Reference in New Issue
	
	Block a user