public void Untampered_hash_matches_the_text() { // Arrange var userAccount = new UserAccount() { Name = "Destination", EmailAddress = "*****@*****.**", Salt = "salt", Hash = "hash" }; var updateModel = new UserAccountUpdateModel() { Name = "Source", EmailAddress = "", Password = "******" }; // Act ModelUpdater.CopyProperties(updateModel, userAccount); bool match = true; // Assert Assert.True(match); }
public ActionResult Details(UserAccountUpdateModel details) { User u = null; PaymentInfoSet ret = null; Tuple <bool, PaymentInfoSet> paymentInfo = null; if (details != null) { using (var repo = Resolver.Resolve <IUserRepository>()) { u = repo.Select(ApplicationContext.Current.User.Id); if (u != null) { u.Name = details.Name; u.Email = details.Email; u.CompanyName = details.CompanyName; u.CompanyAddress = details.CompanyAddress; if (u.Subscription == null) { u.Subscription = new UserSubscription(); } u.Subscription.RenewedTo = details.SubscriptionType; if (!string.IsNullOrEmpty(details.Password)) { if (u.Password == null) { u.Password = new UserPasswordDetails(); } u.Password.Hash = Crypto.GetHash(details.Password); u.Password.ResetToken = string.Empty; } paymentInfo = GetPaymentInformationInternal(u); // This won't allow the user to use the tool before he submits a payment. if (paymentInfo.Item1) { u.Subscription.Renewed = DateTime.UtcNow.AddYears(-2); } repo.Update(u); if (paymentInfo.Item1) { ret = paymentInfo.Item2; } // Updating subscription type for all user presentations. UpdatePresentationSubscriptionType(u.Id, u.Subscription.Type); } } } return(Json(ret)); }