public ActionResult Index(ActivateIndexRequest request) { if (!ModelState.IsValid) { return(View(request)); } this.ApplicationFacade.HashOwnerPassword(request); return(RedirectToAction("mobile")); }
public Owner MapToOwner(Owner to, ActivateIndexRequest request) { to.EmailAddresses[0] = request.Email; if (!String.IsNullOrEmpty(request.Email2)) { to.EmailAddresses[1] = request.Email2; } to.FirstName = request.FirstName; to.LastName = request.LastName; to.Gender = request.Gender; return(to); }
public void HashOwnerPassword(ActivateIndexRequest request) { if (this.CurrentBadge == null) { throw new InvalidOperationException("Badge Nbr was not retrieved from Session!"); } var owner = MapperService.MapToOwner(new Owner(), request); string salt; owner.PasswordHash = this.SecurityService.Hash(request.Password, out salt); owner.PasswordSalt = salt; SessionService["owner"] = owner; }
public override void Given() { base.Given(); TenantResources.SetTenantResourceProvider(new StubResourceProvider()); ContactRequest = new ActivateIndexRequest { Email = "*****@*****.**", ConfirmEmail = "*****@*****.**", Email2 = "*****@*****.**", Gender = Gender.Male, FirstName = "Geoffrey", Password = "******", ConfirmPassword = "******" }; }
public override void Given() { base.Given(); Subject = new ActivateController(this.ApplicationFacade); _request = new ActivateIndexRequest { Gender = Gender.Male, Email = "*****@*****.**", Email2 = "*****@*****.**", //todo:remove magic const ConfirmEmail = "*****@*****.**", Password = "******", ConfirmPassword = "******", }; _owner = DomainStubFactory.CreateOwner(); MockedMapperService.Stub(n => n.MapToOwner(_owner, _request)).Return(_owner).IgnoreArguments(); MockedSessionService.Stub(n => n["badgeNbr"]).Return(new List <Badge>(DomainStubFactory.CreateOwner().Badges)[0].Nbr); string salt; MockedSecurityService.Stub(n => n.Hash(_request.Password, out salt)).Return("hasedPassword").OutRef("theSalt"); }