public int UpdatePhoneNumber(string phoneNumber, string otp) { try { if (!PhoneDetector.IsValidPhone(phoneNumber)) { return(-54); } var accountId = AccountSession.AccountID; var account = AccountDAO.GetAccountById(AccountSession.AccountID); if (!string.IsNullOrEmpty(account.Tel)) { string p = account.Tel; if (!OTP.OTP.ValidateOTP(accountId, otp, p)) { return(-60); } } else { var infoApp = OtpDAO.GetCurrentCounter(accountId); string token = infoApp?.AppT; if (!string.IsNullOrEmpty(infoApp?.AppT)) { if (OTPApp.ValidateOTP($"{Security.MD5Encrypt($"{accountId}_{token}")}_{token}", otp)) { goto doneOTP; } } if (!OTP.OTP.ValidateOTP(accountId, otp, phoneNumber)) { return(-60); } } doneOTP: SecurityDAO.UpdatePhoneNumber(AccountSession.AccountID, phoneNumber); return(1); } catch (Exception ex) { NLogManager.PublishException(ex); } return(-99); }