if (string.IsNullOrEmpty(model.Name) && string.IsNullOrEmpty(model.Email) == false)
{
model.Name = model.Email;
}
model.Username = model.UsernameIsEmail || model.Username == null ? model.Email : model.Username;
var identityUser =
MemberIdentityUser.CreateNew(model.Username, model.Email, model.MemberTypeAlias, true, model.Name);
IdentityResult identityResult = await _memberManager.CreateAsync(
identityUser,
model.Password);
if (identityResult.Succeeded)
{
IMember? member = _memberService.GetByKey(identityUser.Key);
if (member == null)
{
throw new InvalidOperationException($"Could not find a member with key: {member?.Key}.");
}
foreach (MemberPropertyModel property in model.MemberProperties.Where(p => p.Value != null).Where(property => member.Properties.Contains(property.Alias)))
{
member.Properties[property.Alias]?.SetValue(property.Value);
}
//Before we save the member we make sure to assign the group, for this the "Group" must exist in the backoffice.
string memberGroup = "Regular";
AssignMemberGroup(model.Email, memberGroup);
_memberService.Save(member);
if (logMemberIn)
{
await _signInManager.SignInAsync(identityUser, false);
}
}
return identityResult;
}
For this one - the authentication cookie itself works perfect but I don't know how to set the expiration time to be 20 minutes. Can anyone help me to do it?
Umbraco10 - Atuhentication cookie
Hello,
I'm using umbraco version 10.7.0
I want to use Auth cookie in order to go to a protected node, and I want this authentication cookie to have an EXPIRATION TIME OF 20 MINUTES.
I try to use:
If the umbraco member exists: Microsoft.AspNetCore.Identity.SignInResult result3 = Task.Run(async () => await _signInManager.PasswordSignInAsync(Username, Password, false, false)).Result;
If the Umbraco member does not exist:
IdentityResult result2 = Task.Run(async () => await RegisterMemberAsync(RM)).Result;
private async Task
}
For this one - the authentication cookie itself works perfect but I don't know how to set the expiration time to be 20 minutes. Can anyone help me to do it?
This is a while ago now but you do have in appsettings...
Umbraco - CMS - Security - MemberDefaultLockoutTimeInMinutes
is working on a reply...