Changed how login page works based on user feedback. By default, we have the old login flow when authentication is enabled and in addition, we will auto fill the username based on last login on device. (#621)
This commit is contained in:
parent
34d171f0b4
commit
30a302bf99
4 changed files with 42 additions and 14 deletions
|
|
@ -10,6 +10,7 @@ using Microsoft.AspNetCore.Mvc;
|
|||
|
||||
namespace API.Controllers
|
||||
{
|
||||
[Authorize]
|
||||
public class UsersController : BaseApiController
|
||||
{
|
||||
private readonly IUnitOfWork _unitOfWork;
|
||||
|
|
@ -42,11 +43,15 @@ namespace API.Controllers
|
|||
[HttpGet("names")]
|
||||
public async Task<ActionResult<IEnumerable<MemberDto>>> GetUserNames()
|
||||
{
|
||||
var setting = await _unitOfWork.SettingsRepository.GetSettingsDtoAsync();
|
||||
if (setting.EnableAuthentication)
|
||||
{
|
||||
return Unauthorized("This API cannot be used given your server's configuration");
|
||||
}
|
||||
var members = await _unitOfWork.UserRepository.GetMembersAsync();
|
||||
return Ok(members.Select(m => m.Username));
|
||||
}
|
||||
|
||||
[Authorize]
|
||||
[HttpGet("has-reading-progress")]
|
||||
public async Task<ActionResult<bool>> HasReadingProgress(int libraryId)
|
||||
{
|
||||
|
|
@ -55,7 +60,6 @@ namespace API.Controllers
|
|||
return Ok(await _unitOfWork.AppUserProgressRepository.UserHasProgress(library.Type, userId));
|
||||
}
|
||||
|
||||
[Authorize]
|
||||
[HttpGet("has-library-access")]
|
||||
public async Task<ActionResult<bool>> HasLibraryAccess(int libraryId)
|
||||
{
|
||||
|
|
@ -63,7 +67,6 @@ namespace API.Controllers
|
|||
return Ok(libs.Any(x => x.Id == libraryId));
|
||||
}
|
||||
|
||||
[Authorize]
|
||||
[HttpPost("update-preferences")]
|
||||
public async Task<ActionResult<UserPreferencesDto>> UpdatePreferences(UserPreferencesDto preferencesDto)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue