public int CreatedNewPass(string tokenOTP, string newPassword) { try { string decryptToken = Security.TripleDESDecrypt(ConfigurationManager.AppSettings["OTPKey"], System.Web.HttpUtility.UrlDecode(tokenOTP).Replace(" ", "+")); string[] splData = decryptToken.Split('|'); long time = long.Parse(splData[0]); if (TimeSpan.FromTicks(DateTime.Now.Ticks - time).TotalSeconds > 120) { return(-1); //Experied captcha } long accountId = Convert.ToInt64(splData[1]); Regex rPassword = new Regex("^[a-zA-Z0-9_.-]{6,18}$"); if (!rPassword.IsMatch(newPassword)) { return(-30); } if (!rPassword.IsMatch(newPassword)) { return(-30); } var account = AccountDAO.GetAccountInfo(accountId); if (account == null) { return(-31); } SecurityDAO.CreateNewPassword(AccountSession.AccountID, Security.MD5Encrypt(newPassword)); return(1); } catch (Exception ex) { NLogManager.PublishException(ex); } return(-99); }