feat(frontend): hide everything email related if it's disabled on the backend
This commit is contained in:
		
							parent
							
								
									40da4865bc
								
							
						
					
					
						commit
						567e794154
					
				
					 5 changed files with 48 additions and 38 deletions
				
			
		|  | @ -39,10 +39,10 @@ public class AuthController( | |||
|                 + $"&prompt=none&state={state}" | ||||
|                 + $"&redirect_uri={HttpUtility.UrlEncode($"{config.BaseUrl}/auth/callback/discord")}"; | ||||
| 
 | ||||
|         return Ok(new UrlsResponse(discord, null, null)); | ||||
|         return Ok(new UrlsResponse(config.EmailAuth.Enabled, discord, null, null)); | ||||
|     } | ||||
| 
 | ||||
|     private record UrlsResponse(string? Discord, string? Google, string? Tumblr); | ||||
|     private record UrlsResponse(bool EmailEnabled, string? Discord, string? Google, string? Tumblr); | ||||
| 
 | ||||
|     public record AuthResponse( | ||||
|         UserRendererService.UserResponse User, | ||||
|  |  | |||
|  | @ -100,6 +100,8 @@ public class EmailAuthController( | |||
|         [FromBody] CompleteRegistrationRequest req | ||||
|     ) | ||||
|     { | ||||
|         CheckRequirements(); | ||||
| 
 | ||||
|         var email = await keyCacheService.GetKeyAsync($"email:{req.Ticket}"); | ||||
|         if (email == null) | ||||
|             throw new ApiError.BadRequest("Unknown ticket", "ticket", req.Ticket); | ||||
|  | @ -185,6 +187,8 @@ public class EmailAuthController( | |||
|     [Authorize("*")] | ||||
|     public async Task<IActionResult> AddEmailAddressAsync([FromBody] AddEmailAddressRequest req) | ||||
|     { | ||||
|         CheckRequirements(); | ||||
| 
 | ||||
|         var emails = await db | ||||
|             .AuthMethods.Where(m => m.UserId == CurrentUser!.Id && m.AuthType == AuthType.Email) | ||||
|             .ToListAsync(); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue