Skip to content

Commit

Permalink
fix: 验证码时间戳问题 (#284)
Browse files Browse the repository at this point in the history
  • Loading branch information
xujiaji authored Feb 19, 2024
1 parent 0717f59 commit fd453dd
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,9 @@ public void refreshMTVersion() {
public Boolean sendCode(String mobile, String deviceId) {
Map<String, Object> data = new HashMap<>();
data.put("mobile", mobile);
data.put("md5", signature(mobile));
data.put("timestamp", String.valueOf(System.currentTimeMillis()));
final long curTime = System.currentTimeMillis();
data.put("md5", signature(mobile, curTime));
data.put("timestamp", String.valueOf(curTime));
// data.put("MT-APP-Version", MT_VERSION);

HttpRequest request = HttpUtil.createRequest(Method.POST,
Expand Down Expand Up @@ -141,9 +142,10 @@ public boolean login(String mobile, String code, String deviceId) {
map.put("mobile", mobile);
map.put("vCode", code);

map.put("md5", signature(mobile + code + "" + ""));
final long curTime = System.currentTimeMillis();
map.put("md5", signature(mobile + code + "" + "", curTime));

map.put("timestamp", String.valueOf(System.currentTimeMillis()));
map.put("timestamp", String.valueOf(curTime));
map.put("MT-APP-Version", getMTVersion());

HttpRequest request = HttpUtil.createRequest(Method.POST,
Expand Down Expand Up @@ -621,9 +623,9 @@ public static String AesDecrypt(String params) {
* @param content
* @return
*/
private static String signature(String content) {
private static String signature(String content, long time) {

String text = SALT + content + System.currentTimeMillis();
String text = SALT + content + time;
String md5 = "";
try {
MessageDigest md = MessageDigest.getInstance("MD5");
Expand Down

0 comments on commit fd453dd

Please sign in to comment.