public ActionResult VerifyBigDogAccount(VerifyBigDogAccountViewModel model) { // Get the user. ApplicationUser user = UserManager.FindById(User.Identity.GetUserId()); model.Verified = user.ClusterAccountVerified; return(View(model)); }
public async Task <ActionResult> VerifyBigDogAccount(VerifyBigDogAccountViewModel model, string SSHUser, string SSHPass) { // Make sure there is actually information. Otherwise we just return them to the form. if (!string.IsNullOrEmpty(SSHUser) && !string.IsNullOrEmpty(SSHPass)) { bool error = false; model.QuotaRecommendation = Convert.ToString(Accessors.MINIMUM_QUOTA) + "Gb+"; // Check if they have sufficient permissions. if (VerifyAccount.VerifyPermissions(SSHUser, SSHPass)) { model.PermissionsResult = "Your permissions validated successfully!"; } else { model.PermissionsResult = ErrorHandling.error; error = true; } // Check if they have sufficient quota. if (VerifyAccount.VerifyQuota(SSHUser, SSHPass)) { model.QuotaResult = "You have sufficient quota!"; } else { model.QuotaResult = ErrorHandling.error; error = true; } // Get the user. ApplicationUser user = UserManager.FindById(User.Identity.GetUserId()); // If there are no errors, the account is good to go. if (error) { user.ClusterAccountVerified = false; } else { user.ClusterAccountVerified = true; model.Success = true; } // Save the user information. IdentityResult result = await UserManager.UpdateAsync(user); if (!ModelState.IsValid) { throw new Exception("The model passed is not correct and must be investigated."); } return(View(model)); } else { model.Error = "The username and password field cannot be blank."; return(View(model)); } }