public bool ResetPassowrd(string userid, ICommonService configuration, string webRootPath, ref string msg) { bool success = false; try { var found = AdUsers.Where(x => x.ID == userid).ToList(); if (found.Count > 0) { string tempPass = PasswordGenerator.GeneratePassword(true, true, true, false, false, 8); string hash = AuthHelper.HashString(tempPass); found[0].PWord = hash; found[0].chgpass = true; SaveChanges(true); success = EmailHelper.SendTempPassEmail(userid, tempPass, configuration, webRootPath, ref msg); } else { msg = "email not registered..."; } } catch (Exception ex) { Console.WriteLine(ex); msg = ex.InnerException.Message; } return(success); }
public Task <List <AdUser> > SearchDomainUsers(string search) => Task.Run(() => { search = search.ToLower(); var users = AdUsers .Where( x => x.SamAccountName.ToLower().Contains(search) || x.UserPrincipalName.ToLower().Contains(search) || x.DisplayName.ToLower().Contains(search) ) .OrderBy(x => x.Surname) .ToList(); return(users); });
public bool ChangePassowrd(UserInfo user, ref string msg) { bool success = false; try { var found = AdUsers.Where(x => x.ID == user.name).ToList(); if (found.Count > 0) { found[0].PWord = user.fullname; found[0].chgpass = false; SaveChanges(true); success = true; } } catch (Exception ex) { Console.WriteLine(ex); msg = ex.InnerException.Message; } return(success); }
public Task <List <AdUser> > GetDomainUsers() => Task.Run(() => AdUsers.ToList() );
public Task <AdUser> GetAdUser(Guid guid) => Task.Run(() => AdUsers.FirstOrDefault(x => guid.Equals(x.Guid.Value)) );
public Task <AdUser> GetAdUser(string samAccountName) => Task.Run(() => AdUsers.FirstOrDefault(x => x.SamAccountName.ToLower().Equals(samAccountName.ToLower()) ) );