protected void PasswordValidator_ServerValidate(object source, ServerValidateEventArgs args) { // Attempt to log in with supplied credentials try { var cluster = new Registry.Cluster(RegistryContext); cluster.Guid = new Guid(ClusterList.SelectedValue); cluster.Load(); cluster.LoadDomains(false); var domain = cluster.Domains[Registry.Constants.SharedDomainName]; var uu = new UserFactory(RegistryContext); user = uu.LoginUser(domain, Username.Text, Password.Text); RegistryContext.UserGuid = user.Guid; RegistryContext.UserName = user.Name; args.IsValid = true; } catch (EntityNotFoundException) { args.IsValid = false; } }
protected void OldPasswordValidator_ServerValidate(object source, ServerValidateEventArgs args) { if (RegistryUser != null) { var uu = new UserFactory(RegistryContext); args.IsValid = uu.LoginUser(Domain, user.Name, OldPassword.Text) != null; } else { args.IsValid = false; } }
protected void PasswordValidator_ServerValidate(object source, ServerValidateEventArgs args) { // Attempt to log in with supplied credentials try { var uu = new UserFactory(RegistryContext); user = uu.LoginUser(Domain, Username.Text, Password.Text); RegistryContext.UserGuid = user.Guid; RegistryContext.UserName = user.Name; args.IsValid = true; } catch (Exception ex) { LogError(ex); args.IsValid = false; } }
protected void SignIn(Cluster cluster) { cluster.LoadDomains(false); var domain = cluster.Domains[Constants.SharedDomainName]; var uu = new UserFactory(cluster.Context); uu.LoginUser(domain, userName, password); }
private void LoginUser() { // Load user from the registry var uu = new UserFactory(RegistryContext); user = uu.LoginUser(Domain, Username.Text, Password.Text); RegistryContext.UserGuid = user.Guid; RegistryContext.UserName = user.Name; // If there's any temporary identifier set, associate // with the user if (TemporaryPrincipal != null) { var identity = (GraywulfIdentity)TemporaryPrincipal.Identity; var ui = identity.CreateUserIdentity(user); ui.Save(); TemporaryPrincipal = null; } }
protected void SignIn(Cluster cluster) { var uu = new UserFactory(cluster.Context); uu.LoginUser(cluster, userName, password); }
protected User SignInTestUser(Context context) { // TODO: throw exception on logon failure var ef = new EntityFactory(context); //var c = ef.LoadEntity<Cluster>(Cluster.AppSettings.ClusterName); var d = ef.LoadEntity<Domain>(Domain.AppSettings.DomainName); var uu = new UserFactory(context); return uu.LoginUser(d, "test", "alma"); }