mirror of
				https://codeberg.org/forgejo/forgejo.git
				synced 2025-10-31 14:31:02 +00:00 
			
		
		
		
	chore: add email blocklist unit test
This commit is contained in:
		
					parent
					
						
							
								cf1fda81f6
							
						
					
				
			
			
				commit
				
					
						a511e37572
					
				
			
		
					 9 changed files with 92 additions and 21 deletions
				
			
		|  | @ -149,7 +149,7 @@ func CreateUser(ctx *context.APIContext) { | |||
| 		return | ||||
| 	} | ||||
| 
 | ||||
| 	if !validation.IsEmailDomainAllowed(u.Email) { | ||||
| 	if _, ok := validation.IsEmailDomainAllowed(u.Email); !ok { | ||||
| 		ctx.Resp.Header().Add("X-Gitea-Warning", fmt.Sprintf("the domain of user email %s conflicts with EMAIL_DOMAIN_ALLOWLIST or EMAIL_DOMAIN_BLOCKLIST", u.Email)) | ||||
| 	} | ||||
| 
 | ||||
|  | @ -235,7 +235,7 @@ func EditUser(ctx *context.APIContext) { | |||
| 			return | ||||
| 		} | ||||
| 
 | ||||
| 		if !validation.IsEmailDomainAllowed(*form.Email) { | ||||
| 		if _, ok := validation.IsEmailDomainAllowed(*form.Email); !ok { | ||||
| 			ctx.Resp.Header().Add("X-Gitea-Warning", fmt.Sprintf("the domain of user email %s conflicts with EMAIL_DOMAIN_ALLOWLIST or EMAIL_DOMAIN_BLOCKLIST", *form.Email)) | ||||
| 		} | ||||
| 	} | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue