public ActionResult SetPassword(string PasswordRequest, string token) { try { if (!string.IsNullOrEmpty(PasswordRequest) && !string.IsNullOrEmpty(token)) { string encryptedUserName = string.Empty; string _devOpsApplication = System.Configuration.ConfigurationManager.AppSettings["Key"]; string _devOpsHasTable = System.Configuration.ConfigurationManager.AppSettings["HasTable"]; if (!string.IsNullOrEmpty(_devOpsApplication) && !string.IsNullOrEmpty(_devOpsHasTable)) { encryptedUserName = PasswordRequest.GetDecryptedPassword(_devOpsApplication, _devOpsHasTable); token = token.GetDecryptedPassword(_devOpsApplication, _devOpsHasTable); } DAL.DbContextSettings.LoginMaster logMaster = new DAL.DbContextSettings.LoginMaster(); logMaster.UserName = encryptedUserName; logMaster.LoginMasterId = Guid.Parse(token); return(View(logMaster)); } return(View()); } catch (Exception ex) { return(View()); } }
public ActionResult Signup(UserProfileMaster userProfileData) { try { if (userProfileData != null && !string.IsNullOrEmpty(userProfileData.UserName) && !string.IsNullOrEmpty(userProfileData.FirstName) && !string.IsNullOrEmpty(userProfileData.LastName) && !string.IsNullOrEmpty(userProfileData.PrimaryEmail) && !string.IsNullOrEmpty(userProfileData.MobileNumber)) { DAL.DbContextSettings.UserProfileMaster castedUserProfileData = new DAL.DbContextSettings.UserProfileMaster(); castedUserProfileData = userProfileData.GetCastedObject <DAL.DbContextSettings.UserProfileMaster>(castedUserProfileData); if (castedUserProfileData != null && !string.IsNullOrEmpty(castedUserProfileData.PrimaryEmail)) { castedUserProfileData.UserProfileId = Guid.NewGuid(); _repoUnitOfWork.SignupRepository.Add(castedUserProfileData); _repoUnitOfWork.Complete(); if (castedUserProfileData.UserProfileId != null) { DAL.DbContextSettings.LoginMaster castedLoginMaster = new DAL.DbContextSettings.LoginMaster(); castedLoginMaster = userProfileData.GetCastedObject <DAL.DbContextSettings.LoginMaster>(castedLoginMaster); castedLoginMaster.LoginMasterId = Guid.NewGuid(); castedLoginMaster.UserName = userProfileData.UserName; string _devOpsApplication = System.Configuration.ConfigurationManager.AppSettings["Key"]; string _devOpsHasTable = System.Configuration.ConfigurationManager.AppSettings["HasTable"]; string encryptedUserName = string.Empty; if (!string.IsNullOrEmpty(_devOpsApplication) && !string.IsNullOrEmpty(_devOpsHasTable)) { encryptedUserName = userProfileData.UserName.GetEncryptedPassword(_devOpsApplication, _devOpsHasTable); if (!string.IsNullOrEmpty(encryptedUserName)) { castedLoginMaster.LoginPassword = encryptedUserName; } } castedLoginMaster.UserProfileId = castedUserProfileData.UserProfileId; _repoUnitOfWork.LoginRepository.Add(castedLoginMaster); int saved = _repoUnitOfWork.Complete(); if (saved > -1) { string guidToken = castedLoginMaster.LoginMasterId.ToString(); if (!string.IsNullOrEmpty(_devOpsApplication) && !string.IsNullOrEmpty(_devOpsHasTable)) { guidToken = guidToken.GetEncryptedPassword(_devOpsApplication, _devOpsHasTable); } ExtensionMethods.SendResetPasswordLink("*****@*****.**", encryptedUserName, true, guidToken); Session["Signup"] = null; Session["SignupSuccessfully"] = "True"; return(RedirectToAction("LoginView")); } } } } else { return(View()); } } catch (Exception ex) { } return(View()); }
public ActionResult SetPassword(DAL.DbContextSettings.LoginMaster _loginMaster) { try { DAL.DbContextSettings.LoginMaster _loginMasterForUpdate = _repoUnitOfWork.LoginRepository.Find(a => a.LoginMasterId == _loginMaster.LoginMasterId); _loginMasterForUpdate.LoginPassword = _loginMaster.LoginPassword; _repoUnitOfWork.LoginRepository.Update(_loginMasterForUpdate); int updatedId = _repoUnitOfWork.Complete(); if (updatedId > -1) { return(RedirectToAction("LoginView")); } return(View()); } catch (Exception ex) { return(View("Login")); } }