Ensure default reading profile is created when creating a user
This commit is contained in:
parent
cfc65d14a0
commit
cfab91a29b
4 changed files with 25 additions and 3 deletions
|
|
@ -153,6 +153,9 @@ public class AccountController : BaseApiController
|
|||
// Assign default streams
|
||||
AddDefaultStreamsToUser(user);
|
||||
|
||||
// Assign default reading profile
|
||||
AddDefaultReadingProfileToUser(user);
|
||||
|
||||
var token = await _userManager.GenerateEmailConfirmationTokenAsync(user);
|
||||
if (string.IsNullOrEmpty(token)) return BadRequest(await _localizationService.Get("en", "confirm-token-gen"));
|
||||
if (!await ConfirmEmailToken(token, user)) return BadRequest(await _localizationService.Get("en", "validate-email", token));
|
||||
|
|
@ -669,6 +672,9 @@ public class AccountController : BaseApiController
|
|||
// Assign default streams
|
||||
AddDefaultStreamsToUser(user);
|
||||
|
||||
// Assign default reading profile
|
||||
AddDefaultReadingProfileToUser(user);
|
||||
|
||||
// Assign Roles
|
||||
var roles = dto.Roles;
|
||||
var hasAdminRole = dto.Roles.Contains(PolicyConstants.AdminRole);
|
||||
|
|
@ -779,6 +785,15 @@ public class AccountController : BaseApiController
|
|||
}
|
||||
}
|
||||
|
||||
private void AddDefaultReadingProfileToUser(AppUser user)
|
||||
{
|
||||
var profile = new AppUserReadingProfileBuilder(user.Id)
|
||||
.WithName("Default Profile")
|
||||
.Build();
|
||||
user.UserPreferences.ReadingProfiles.Add(profile);
|
||||
user.UserPreferences.DefaultReadingProfile = profile;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Last step in authentication flow, confirms the email token for email
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue