public async Task <QueryResult> Execute(List <Query> existedQueries) { var queryIdentifier = Guid.NewGuid().ToString(); var firstQuery = new Query(queryIdentifier, "AuthSession"); firstQuery.Parameters.Add(new QueryParameter("in", "Login", _login)); firstQuery.Parameters.Add(new QueryParameter("in", "PasswordHash", _hashGenerator.Generate(_password, true))); firstQuery.Parameters.Add(new QueryParameter("in", "SocAccount_Name", "Technical")); var fulllistQuery = new List <Query> { firstQuery }; Query lastQuery = new Query(Guid.NewGuid().ToString(), "CloseSession"); foreach (var query in existedQueries) { query.ParentQueryGUID.Add(queryIdentifier); fulllistQuery.Add(query); lastQuery.ParentQueryGUID.Add(query.GUID); } lastQuery.ParentQueryGUID.Add(queryIdentifier); fulllistQuery.Add(lastQuery); var queries = await _executor.Execute(fulllistQuery).ConfigureAwait(false); return(queries); }
public string GetImageUrl(string email) { var emailHash = _hashGenerator.Generate(email); if (string.IsNullOrWhiteSpace(emailHash)) { return(null); } return($"{ServiceAddress}{emailHash}{DefaultSizeParam}"); }
public async Task <IActionResult> Login(LoginModelViewModel model, string returnUrl = null) { ViewData["ReturnUrl"] = returnUrl; if (ModelState.IsValid) { var authenticateResult = await _sessionProvider.Authenticate(model.Email, _hashGenerator.Generate(model.Password, true)); if (authenticateResult.ResultMessage.MessageType != MessageType.Error) { var userModel = new UserModel(model.Email, _hashGenerator.Generate(model.Password, true), authenticateResult.Model.SessionId); _userManager.SetUser(userModel); return(RedirectToLocal(returnUrl)); } else { ModelState.AddModelError(String.Empty, authenticateResult.ResultMessage.Message); } } return(View(model)); }
public IActionResult AddLink([FromBody] AddLinkInput input) { var linkData = new LinkData() { Link = input.Link }; repository.Add(linkData); linkData.Hash = generator.Generate(linkData.Id); repository.Update(linkData); return(Ok(new { response = "Ok" })); }
public string Login(string userName, string password, bool isPersistent) { var hashedPassword = _generator.Generate(password); var user = _userRepository.First(u => (u.Login == userName || u.Email == userName) && u.Password == password); if (user == null) { return(null); } User = new UserProvider(userName, _userRepository); var encryptedTicket = CreateTicket(user.Id, isPersistent); return(encryptedTicket); }