public string RecoverPassword(string username) { MembershipUser mu = Membership.GetUser(username); string MsgOut = string.Empty; if (mu != null) { if (mu.IsLockedOut) { MsgOut = "Your Account is locked. Please go back and use unlock account link"; } else { CommonClass objCommonClass = new CommonClass(); string TypeCode = objCommonClass.GetUserType(mu.UserName); if (TypeCode != "CG") { ArrayList arMail = new ArrayList(); arMail = objCommonClass.Getmail(mu.UserName); string strBody = ""; strBody += "Dear <b>" + arMail[3].ToString() + "</b>,<br/><br/>Please find your login credentials below:<br/>"; //strBody += " User Name: " + strUserName + "<br/>"; strBody += " Password: "******"<br/>"; strBody += " CG Care,<br/>"; SqlParameter[] sqlParam = { new SqlParameter("@Email", arMail[1].ToString()), new SqlParameter("@body", strBody) }; int suc = ObjSql.ExecuteNonQuery(CommandType.StoredProcedure, "uspSendMailForPassword", sqlParam); // objCommonClass.SendMailSMTP(arMail[1].ToString().Trim(), ConfigurationManager.AppSettings["FromMailId"].ToString(), "Login Details", strBody, true); MsgOut = string.Empty; } else { MsgOut = "CG Employees cannot unlock their account from this Page. Contact CG hr4u Team."; } } } else { MsgOut = "Invalid User Id"; } return(MsgOut); }
void UpdatePasswordHisortLog(string userName, string newPassword, string Remarks) { SqlParameter[] sqlParamSrh = { new SqlParameter("@MessageOut", SqlDbType.VarChar, 200), new SqlParameter("@Return_Value", SqlDbType.Int), new SqlParameter("@Type", "LOG_PASSWORD_HISTORY"), new SqlParameter("@UserName", userName), new SqlParameter("@Password", newPassword), new SqlParameter("@DecPassword", BPSecurity.UnprotectPassword(newPassword)), new SqlParameter("@SpecialRemarks", Remarks), new SqlParameter("@SystemIP", this.IPAddress) }; sqlParamSrh[0].Direction = ParameterDirection.Output; sqlParamSrh[1].Direction = ParameterDirection.ReturnValue; ObjSql.ExecuteNonQuery(CommandType.StoredProcedure, "uspEditUserAndRoleMaster", sqlParamSrh); //ReturnValue = int.Parse(sqlParamSrh[1].Value.ToString()); if (int.Parse(sqlParamSrh[1].Value.ToString()) == -1) { this.Message = sqlParamSrh[0].Value.ToString(); } }