public IActionResult criarSenha([FromBody] NovaSenhaDTO token) { try { if (!this._service.ValidaSenha(token.Senha)) { return(BadRequest(new { message = "Senha fornecida não satisfaz condições pré definidas!" })); } var usuario = this._service.ValidarToken(token); if (usuario == null) { return(BadRequest()); } byte[] passwordHash, passwordSalt; AppAccount appAccount = new AppAccount(); appAccount.CreatePasswordHash(token.Senha, out passwordHash, out passwordSalt); usuario.PasswordHash = passwordHash; usuario.PasswordSalt = passwordSalt; //var userDTO = this._mapper.Map<UserDTO>(usuario); //this.atualizarUsuario(userDTO); this._service.Update(usuario); return(Ok()); } catch (Exception ex) { return(BadRequest(new { message = ex.Message })); } }
public CreateUser(PatinhasContext context, User user, string password) { _context = context; _user = user; _password = password; appAccount = new AppAccount(); }
private string GetToken(AppAccount config) { var authClient = new AuthHandler(config.InstanceName); var token = authClient.GetTokenInfo(config.AppClientId, config.AppClientSecret, config.Email, config.Password, AppScopeEnum.Follow | AppScopeEnum.Read | AppScopeEnum.Write); return(token.access_token); }
public AuthenticateUser(PatinhasContext context, string email, string password) { this._context = context; this._email = email; this._password = password; appAccount = new AppAccount(); }
public Autenticar(OctoplusContext context, UserDTO user) { _context = context; _context.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking; _email = user.Email; _password = user.Password; _usuario = user; this.appAccount = new AppAccount(); }
public async Task <IAppAccount> Create() { try { var crmService = StartupHelper.CreateCrmService(); IAccountRepository accountRepository = new AccountRepository(); IAccountService accountService = new AccountService(crmService, accountRepository); IAppAccount app = new AppAccount(accountService); return(app); } catch (Exception ex) { throw ex; } }
private string criarToken(int usuarioid, int empresaid) { Guid pass = Guid.NewGuid(); var chave = AppAccount.CreateMD5(pass.ToString()); var token = new Token() { UsuarioId = usuarioid, Chave = chave, DataExpiracao = DateTime.Now.AddHours(1) }; this._context.Token.Add(token); this._context.SaveChanges(); return(chave); }
public void RegisterAccount(RegisterAccountRequest request) { if (request == null) { return; } var accountToAdd = new AppAccount(); accountToAdd.Email = request.Email; accountToAdd.Password = request.Password; _appDbContext.T_IBS_App_Accounts.Add(accountToAdd); _appDbContext.SaveChanges(); var customerToAdd = new Customer(); customerToAdd.First_Name = request.FirstName; customerToAdd.Last_Name = request.LastName; customerToAdd.CNP = request.Cnp; customerToAdd.Age = request.Age; _appDbContext.T_IBS_CUSTOMERS.Add(customerToAdd); _appDbContext.SaveChanges(); var justAddedCustomer = from o in _appDbContext.T_IBS_CUSTOMERS select o.Id_Customer; var justAddedAcc = from o in _appDbContext.T_IBS_App_Accounts select o.Id_App_Account; var jointAccount = new JoinCustomerAppAccounts(); jointAccount.Id_Customer = justAddedCustomer.ToList().Max(); jointAccount.Id_App_Account = justAddedAcc.ToList().Max(); _appDbContext.T_IBS_Join_Customers_App_Accounts.Add(jointAccount); _appDbContext.SaveChanges(); }
public ValidatePassword(PatinhasContext context, UserDTO userDto) { _context = context; _userDto = userDto; appAccount = new AppAccount(); }
public CadastrarNovaSenha(OctoplusContext context) { _context = context; _emailservice = new EmailService(_context); _app = new AppAccount(); }
public ResetPassword(PatinhasContext context, string email) { this._context = context; this._email = email; this.appAccount = new AppAccount(); }
public AppAccountDataObject GetAppAccountByName(string name) { AppAccount appAccount = appAccountRepository.Find(Specification <AppAccount> .Eval(app => app.Name.Equals(name))); return(AutoMapper.Mapper.Map <AppAccount, AppAccountDataObject>(appAccount)); }
public AppAccountDataObject GetAppAccountByKey(Guid id) { AppAccount appAccount = appAccountRepository.GetByKey(id); return(AutoMapper.Mapper.Map <AppAccount, AppAccountDataObject>(appAccount)); }
public CadastrarUsuario(OctoplusContext context, UserDTO cadastroUsuario) { _context = context; _cadastroUsuario = cadastroUsuario; appAccount = new AppAccount(); }