public static bool VerifyPassword(this User @this, string clearTextPassword) { if (string.IsNullOrWhiteSpace(clearTextPassword)) { return(false); } var securityService = @this.Session().ServiceProvider.GetRequiredService <IPasswordService>(); return(securityService.VerifyHashedPassword(@this.UserName, @this.UserPasswordHash, clearTextPassword)); }
public static void CoreOnDerive(this User @this, ObjectOnDerive method) { @this.DerivedRoles.NormalizedUserName = Users.Normalize(@this.UserName); @this.DerivedRoles.NormalizedUserEmail = Users.Normalize(@this.UserEmail); if (@this.ExistInUserPassword) { var passwordService = @this.Session().ServiceProvider.GetRequiredService <IPasswordService>(); @this.UserPasswordHash = passwordService.HashPassword(@this.UserName, @this.InUserPassword); @this.RemoveInUserPassword(); } }
public static bool IsAdministrator(this User @this) { var administrators = new UserGroups(@this.Session()).Administrators; return(administrators.Members.Contains(@this)); }