Pre-Release Shakeout (#1932)

* Allow users to setup an account with a fake email and the same username without hitting the validate username code.

* Fixed a bug where opds url could have //.

Fixed a bug where baseurl wasn't being used for invite link generation

* Fixed enum mismatch causing age rating to display incorrectly on UI
This commit is contained in:
Joe Milazzo 2023-04-16 19:28:21 -05:00 committed by GitHub
parent 202a35dc7c
commit e7618861e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 43 additions and 17 deletions

View file

@ -647,7 +647,11 @@ public class AccountController : BaseApiController
// Validate Password and Username
var validationErrors = new List<ApiException>();
validationErrors.AddRange(await _accountService.ValidateUsername(dto.Username));
// This allows users that use a fake email with the same username to continue setting up the account
if (!dto.Username.Equals(dto.Email) && !user.UserName!.Equals(dto.Username))
{
validationErrors.AddRange(await _accountService.ValidateUsername(dto.Username));
}
validationErrors.AddRange(await _accountService.ValidatePassword(user, dto.Password));
if (validationErrors.Any())

View file

@ -24,5 +24,6 @@ public class UpdateLibraryDto
public bool IncludeInSearch { get; init; }
[Required]
public bool ManageCollections { get; init; }
[Required]
public bool ManageReadingLists { get; init; }
}

View file

@ -7,6 +7,7 @@ using API.Constants;
using API.Data;
using API.Entities;
using API.Errors;
using Kavita.Common;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
@ -67,6 +68,10 @@ public class AccountService : IAccountService
if (!string.IsNullOrEmpty(serverSettings.HostName))
{
basePart = serverSettings.HostName;
if (!serverSettings.BaseUrl.Equals(Configuration.DefaultBaseUrl))
{
basePart += serverSettings.BaseUrl.Substring(0, serverSettings.BaseUrl.Length - 1);
}
}
if (withHost) return $"{basePart}/registration/{routePart}?token={HttpUtility.UrlEncode(token)}&email={HttpUtility.UrlEncode(email)}";

View file

@ -488,7 +488,7 @@ public class ReadingListService : IReadingListService
}
}
private IList<Tuple<string, string>> GeneratePairs(string filename, string storyArc, string storyArcNumbers)
private IEnumerable<Tuple<string, string>> GeneratePairs(string filename, string storyArc, string storyArcNumbers)
{
var data = new List<Tuple<string, string>>();
if (string.IsNullOrEmpty(storyArc)) return data;

View file

@ -61,7 +61,8 @@ public class TaskScheduler : ITaskScheduler
public const string ScanLibrariesTaskId = "scan-libraries";
public const string ReportStatsTaskId = "report-stats";
private static readonly ImmutableArray<string> ScanTasks = ImmutableArray.Create("ScannerService", "ScanLibrary", "ScanLibraries", "ScanFolder", "ScanSeries");
private static readonly ImmutableArray<string> ScanTasks =
ImmutableArray.Create("ScannerService", "ScanLibrary", "ScanLibraries", "ScanFolder", "ScanSeries");
private static readonly Random Rnd = new Random();

View file

@ -2,5 +2,5 @@
"TokenKey": "super secret unguessable key",
"Port": 5000,
"IpAddresses": "",
"BaseUrl": "/"
"BaseUrl": "/test/"
}