public static string EncryptPasswordString(string password) { Encrypt64 encrypt = new Encrypt64(); Random r = new Random(); return(encrypt.Encrypt(password, secureKey)); }
/// <summary> /// generate password for users in encrypted format /// </summary> /// <returns></returns> public static string EncryptPassword() { Encrypt64 encrypt = new Encrypt64(); Random r = new Random(); string password = encrypt.Encrypt("SF" + r.Next(11111, 99999).ToString(), secureKey); return(password); }
public static string FncSend_StratasBoard_ForgotPassword_ToClient(long stratasBoardId) { try { using (var db = new StratasFairDBEntities()) { var stratasDetails = db.vw_GetStratasBoard.Where(m => m.StratasBoardId == stratasBoardId).SingleOrDefault(); if (stratasDetails != null) { Encrypt64 encrypt = new Encrypt64(); string EncryptedUserClientId = encrypt.Encrypt(stratasDetails.UserClientId.ToString(), ConfigurationManager.AppSettings["SecureKey"].ToString()); EncryptedUserClientId = EncryptedUserClientId.Replace("+", "$"); EncryptedUserClientId = EncryptedUserClientId.Replace("/", "!"); string url = ConfigurationManager.AppSettings["WebsiteRootPath"].ToString(); string body = string.Empty; string subject = string.Empty; getConfigValue("forget-password-client", out body, out subject); EmailSender emailSender = GetCommonDataForSendMail(stratasDetails.EmailId, subject); StringBuilder mailBody = new StringBuilder(); mailBody.Append(body); mailBody.Replace("{BASEPATH}/", url); mailBody.Replace("{URL}", url + stratasDetails.PortalLink + "/logon/ResetPassword/" + EncryptedUserClientId); mailBody.Replace("{NAME}", stratasDetails.FirstName + " " + stratasDetails.LastName); mailBody.Replace("{STRATANAME}", stratasDetails.StratasBoardName); mailBody.Replace("{PORTALURL}", stratasDetails.PortalLink); mailBody.Replace("{EMAILADDRESS}", stratasDetails.EmailId); emailSender.Body = mailBody.ToString(); //for attachment //emailSender.AttachmentList = new ArrayList(1); //emailSender.AttachmentList.Add(System.Web.HttpContext.Current.Server.MapPath(objOrder.InvoiceFilePath)); emailSender = FncSendMail(emailSender); return(emailSender.ErrorMessage); } else { return(""); } } } catch (Exception ex) { return(ex.Message.ToString()); } }