Kavita is a fast, feature rich, cross platform reading server. Built with the goal of being a full solution for all your reading needs. Setup your own server and share your reading collection with your friends and family.
C# annotationscbzcomicinfocomicscomics-readercross-platformcsharpepubepub-readerfreelinuxmangamedia-servermetadataopdsopds-feedpdfself-hostedubooquitywindows
Email Hotfix (#1068)
Joseph Milazzo2193451dfb9e
diff --git a/.gitignore b/.gitignoreindex bc03f54c7..8bc302ff8 100644--- a/.gitignore+++ b/.gitignore@@ -526,3 +526,4 @@ API/config/post-metadata/API.Tests/TestResults/UI/Web/.vscode/settings.json/API.Tests/Services/Test Data/ArchiveService/CoverImages/output/*+UI/Web/.angular/diff --git a/API/Controllers/AccountController.cs b/API/Controllers/AccountController.csindex 77b14ec21..9765f700e 100644--- a/API/Controllers/AccountController.cs+++ b/API/Controllers/AccountController.cs@@ -409,7 +409,7 @@ namespace API.Controllersif (string.IsNullOrEmpty(token)) return BadRequest("There was an issue sending email");var emailLink = GenerateEmailLink(token, "confirm-email", dto.Email);- _logger.LogInformation("[Invite User]: Email Link for {UserName}: {Link}", user.UserName, emailLink);+ _logger.LogCritical("[Invite User]: Email Link for {UserName}: {Link}", user.UserName, emailLink);if (dto.SendEmail){await _emailService.SendConfirmationEmail(new ConfirmationEmailDto()@@ -507,7 +507,7 @@ namespace API.Controllers}var emailLink = GenerateEmailLink(await _userManager.GeneratePasswordResetTokenAsync(user), "confirm-reset-password", user.Email);- _logger.LogInformation("[Forgot Password]: Email Link for {UserName}: {Link}", user.UserName, emailLink);+ _logger.LogCritical("[Forgot Password]: Email Link for {UserName}: {Link}", user.UserName, emailLink);var host = _environment.IsDevelopment() ? "localhost:4200" : Request.Host.ToString();if (await _emailService.CheckIfAccessible(host)){@@ -561,7 +561,7 @@ namespace API.Controllersif (user.EmailConfirmed) return BadRequest("User already confirmed");var emailLink = GenerateEmailLink(await _userManager.GenerateEmailConfirmationTokenAsync(user), "confirm-email", user.Email);- _logger.LogInformation("[Email Migration]: Email Link: {Link}", emailLink);+ _logger.LogCritical("[Email Migration]: Email Link: {Link}", emailLink);await _emailService.SendMigrationEmail(new EmailMigrationDto(){EmailAddress = user.Email,@@ -615,21 +615,23 @@ namespace API.Controllerstry{var token = await _userManager.GenerateEmailConfirmationTokenAsync(user);- if (string.IsNullOrEmpty(token)) return BadRequest("There was an issue sending email");+ //if (string.IsNullOrEmpty(token)) return BadRequest("There was an issue sending email");user.Email = dto.Email;+ if (!await ConfirmEmailToken(token, user)) return BadRequest("There was a critical error during migration");_unitOfWork.UserRepository.Update(user);+await _unitOfWork.CommitAsync();- var emailLink = GenerateEmailLink(await _userManager.GenerateEmailConfirmationTokenAsync(user), "confirm-migration-email", user.Email);- _logger.LogInformation("[Email Migration]: Email Link for {UserName}: {Link}", dto.Username, emailLink);- // Always send an email, even if the user can't click it just to get them conformable with the system- await _emailService.SendMigrationEmail(new EmailMigrationDto()- {- EmailAddress = dto.Email,- Username = user.UserName,- ServerConfirmationLink = emailLink- });- return Ok(emailLink);+ //var emailLink = GenerateEmailLink(await _userManager.GenerateEmailConfirmationTokenAsync(user), "confirm-migration-email", user.Email);+ // _logger.LogCritical("[Email Migration]: Email Link for {UserName}: {Link}", dto.Username, emailLink);+ // // Always send an email, even if the user can't click it just to get them conformable with the system+ // await _emailService.SendMigrationEmail(new EmailMigrationDto()+ // {+ // EmailAddress = dto.Email,+ // Username = user.UserName,+ // ServerConfirmationLink = emailLink+ // });+ return Ok();}catch (Exception ex){diff --git a/API/config/kavita.db.dik b/API/config/kavita.db.diknew file mode 100644index 000000000..4d71b8263Binary files /dev/null and b/API/config/kavita.db.dik differdiff --git a/API/config/kavita.db.new b/API/config/kavita.db.newnew file mode 100644index 000000000..774d54743Binary files /dev/null and b/API/config/kavita.db.new differdiff --git a/Kavita.Common/Kavita.Common.csproj b/Kavita.Common/Kavita.Common.csprojindex 91a6ab754..26d770327 100644--- a/Kavita.Common/Kavita.Common.csproj+++ b/Kavita.Common/Kavita.Common.csproj@@ -4,7 +4,7 @@<TargetFramework>net6.0</TargetFramework><Company>kavitareader.com</Company><Product>Kavita</Product>- <AssemblyVersion>0.5.1.0</AssemblyVersion>+ <AssemblyVersion>0.5.1.1</AssemblyVersion><NeutralLanguage>en</NeutralLanguage></PropertyGroup>diff --git a/UI/Web/src/app/registration/add-email-to-account-migration-modal/add-email-to-account-migration-modal.component.ts b/UI/Web/src/app/registration/add-email-to-account-migration-modal/add-email-to-account-migration-modal.component.tsindex 4899f67b7..ae273e0e9 100644--- a/UI/Web/src/app/registration/add-email-to-account-migration-modal/add-email-to-account-migration-modal.component.ts+++ b/UI/Web/src/app/registration/add-email-to-account-migration-modal/add-email-to-account-migration-modal.component.ts@@ -26,7 +26,7 @@ export class AddEmailToAccountMigrationModalComponent implements OnInit {error: string = '';constructor(private accountService: AccountService, private modal: NgbActiveModal,- private serverService: ServerService, private confirmService: ConfirmService) {+ private serverService: ServerService, private confirmService: ConfirmService, private toastr: ToastrService) {}ngOnInit(): void {@@ -40,25 +40,23 @@ export class AddEmailToAccountMigrationModalComponent implements OnInit {}save() {- this.serverService.isServerAccessible().subscribe(canAccess => {- const model = this.registerForm.getRawValue();- model.sendEmail = canAccess;- this.accountService.migrateUser(model).subscribe(async (email) => {- console.log(email);- if (!canAccess) {- // Display the email to the user- this.emailLink = email;- await this.confirmService.alert('Please click this link to confirm your email. You must confirm to be able to login. The link is in your logs. You may need to log out of the current account before clicking. <br/> <a href="' + this.emailLink + '" target="_blank">' + this.emailLink + '</a>');- this.modal.close(true);- } else {- await this.confirmService.alert('Please check your email (or logs under "Email Link") for the confirmation link. You must confirm to be able to login.');- this.modal.close(true);- }+ const model = this.registerForm.getRawValue();+ model.sendEmail = false;+ this.accountService.migrateUser(model).subscribe(async () => {+ // if (!canAccess) {+ // // Display the email to the user+ // this.emailLink = email;+ // await this.confirmService.alert('Please click this link to confirm your email. You must confirm to be able to login. The link is in your logs. You may need to log out of the current account before clicking. <br/> <a href="' + this.emailLink + '" target="_blank">' + this.emailLink + '</a>');+ // this.modal.close(true);+ // } else {+ // await this.confirmService.alert('Please check your email (or logs under "Email Link") for the confirmation link. You must confirm to be able to login.');+ // this.modal.close(true);+ // }+ this.toastr.success('Email has been validated');+ this.modal.close(true);}, err => {this.error = err;});- });-}