Misc Bugfixes (#2832)
This commit is contained in:
parent
57fb2d01b9
commit
0277f8f4c7
22 changed files with 172 additions and 179 deletions
|
@ -363,7 +363,7 @@ public class AccountController : BaseApiController
|
|||
}
|
||||
|
||||
// Validate no other users exist with this email
|
||||
if (user.Email!.Equals(dto.Email)) return Ok(await _localizationService.Translate(User.GetUserId(), "nothing-to-do"));
|
||||
if (user.Email!.Equals(dto.Email)) return BadRequest(await _localizationService.Translate(User.GetUserId(), "nothing-to-do"));
|
||||
|
||||
// Check if email is used by another user
|
||||
var existingUserEmail = await _unitOfWork.UserRepository.GetUserByEmailAsync(dto.Email);
|
||||
|
@ -386,8 +386,12 @@ public class AccountController : BaseApiController
|
|||
user.ConfirmationToken = token;
|
||||
await _userManager.UpdateAsync(user);
|
||||
|
||||
var emailLink = await _emailService.GenerateEmailLink(Request, user.ConfirmationToken, "confirm-email-update", dto.Email);
|
||||
_logger.LogCritical("[Update Email]: Email Link for {UserName}: {Link}", user.UserName, emailLink);
|
||||
|
||||
if (!shouldEmailUser)
|
||||
{
|
||||
_logger.LogInformation("Cannot email admin, email not setup or admin email invalid");
|
||||
return Ok(new InviteUserResponse
|
||||
{
|
||||
EmailLink = string.Empty,
|
||||
|
@ -399,9 +403,6 @@ public class AccountController : BaseApiController
|
|||
// Send a confirmation email
|
||||
try
|
||||
{
|
||||
var emailLink = await _emailService.GenerateEmailLink(Request, user.ConfirmationToken, "confirm-email-update", dto.Email);
|
||||
_logger.LogCritical("[Update Email]: Email Link for {UserName}: {Link}", user.UserName, emailLink);
|
||||
|
||||
if (!_emailService.IsValidEmail(user.Email))
|
||||
{
|
||||
_logger.LogCritical("[Update Email]: User is trying to update their email, but their existing email ({Email}) isn't valid. No email will be send", user.Email);
|
||||
|
@ -839,6 +840,7 @@ public class AccountController : BaseApiController
|
|||
return BadRequest(await _localizationService.Translate(user.Id, "generic-user-email-update"));
|
||||
}
|
||||
user.ConfirmationToken = null;
|
||||
user.EmailConfirmed = true;
|
||||
await _unitOfWork.CommitAsync();
|
||||
|
||||
|
||||
|
|
|
@ -1123,7 +1123,9 @@ public class OpdsController : BaseApiController
|
|||
Id = mangaFile.Id.ToString(),
|
||||
Title = title,
|
||||
Extent = fileSize,
|
||||
Summary = $"{fileType.Split("/")[1]} - {fileSize}",
|
||||
Summary = $"File Type: {fileType.Split("/")[1]} - {fileSize}" + (string.IsNullOrWhiteSpace(chapter.Summary)
|
||||
? string.Empty
|
||||
: $" Summary: {chapter.Summary}"),
|
||||
Format = mangaFile.Format.ToString(),
|
||||
Links = new List<FeedLink>()
|
||||
{
|
||||
|
@ -1279,7 +1281,7 @@ public class OpdsController : BaseApiController
|
|||
};
|
||||
}
|
||||
|
||||
private string SerializeXml(Feed feed)
|
||||
private string SerializeXml(Feed? feed)
|
||||
{
|
||||
if (feed == null) return string.Empty;
|
||||
using var sm = new StringWriter();
|
||||
|
|
|
@ -511,6 +511,7 @@ public class SettingsController : BaseApiController
|
|||
public async Task<ActionResult<EmailTestResultDto>> TestEmailServiceUrl()
|
||||
{
|
||||
var user = await _unitOfWork.UserRepository.GetUserByIdAsync(User.GetUserId());
|
||||
if (string.IsNullOrEmpty(user?.Email)) return BadRequest("Your account has no email on record. Cannot email.");
|
||||
return Ok(await _emailService.SendTestEmail(user!.Email));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,7 +112,6 @@ public class UsersController : BaseApiController
|
|||
existingPreferences.GlobalPageLayoutMode = preferencesDto.GlobalPageLayoutMode;
|
||||
existingPreferences.BlurUnreadSummaries = preferencesDto.BlurUnreadSummaries;
|
||||
existingPreferences.LayoutMode = preferencesDto.LayoutMode;
|
||||
existingPreferences.Theme = preferencesDto.Theme ?? await _unitOfWork.SiteThemeRepository.GetDefaultTheme();
|
||||
existingPreferences.PromptForDownloadSize = preferencesDto.PromptForDownloadSize;
|
||||
existingPreferences.NoTransitions = preferencesDto.NoTransitions;
|
||||
existingPreferences.SwipeToPaginate = preferencesDto.SwipeToPaginate;
|
||||
|
@ -124,6 +123,12 @@ public class UsersController : BaseApiController
|
|||
existingPreferences.PdfScrollMode = preferencesDto.PdfScrollMode;
|
||||
existingPreferences.PdfSpreadMode = preferencesDto.PdfSpreadMode;
|
||||
|
||||
if (existingPreferences.Theme.Id != preferencesDto.Theme?.Id)
|
||||
{
|
||||
existingPreferences.Theme = preferencesDto.Theme ?? await _unitOfWork.SiteThemeRepository.GetDefaultTheme();
|
||||
}
|
||||
|
||||
|
||||
if (_localizationService.GetLocales().Contains(preferencesDto.Locale))
|
||||
{
|
||||
existingPreferences.Locale = preferencesDto.Locale;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue