Redis-based short message verification code interface anti-refreshing method and Redis-based short message verification code interface anti-refreshing device
By combining front-end and back-end anti-fraud mechanisms and using Redis to manage the time and frequency of SMS verification codes, the problem of malicious attacks and repeated sending of SMS verification code service interfaces was solved, and strict frequency limits and lifecycle management were achieved, improving system security and performance.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHANGHAI YUNDA HIGH TECH CO LTD
- Filing Date
- 2026-01-28
- Publication Date
- 2026-05-01
AI Technical Summary
In existing technologies, SMS verification code services suffer from malicious attacks and abuse of interfaces, long validity periods for verification codes, insufficient timeliness and anti-duplicate sending capabilities, and a lack of strict sending frequency limits. Users can bypass these restrictions and repeatedly trigger requests by refreshing the page.
A Redis-based method for preventing SMS verification code spam is adopted. Through a combined front-end and back-end anti-scraping mechanism, Redis is used for verification code time management and frequency limits. This includes front-end button status checks, Redis anti-scraping checks, and integration with third-party SMS services to achieve a strict 60-second sending frequency limit and verification code lifecycle management.
It significantly improves system security and performance, prevents duplicate sending and CAPTCHA abuse, reduces database pressure, enhances the system's ability to resist malicious attacks, has a clear and scalable structure, and improves resource utilization and service quality.
Smart Images

Figure CN121968110A_ABST
Abstract
Description
Redis-based methods and devices for preventing SMS verification code API fraud. Technical Field
[0001] This invention relates to the field of SMS verification technology, and in particular to a method and apparatus for preventing SMS verification code manipulation based on Redis. Background Technology
[0002] In current internet businesses, SMS verification codes are a crucial security measure for registration, login, and payment scenarios. However, current SMS verification code services face issues such as malicious attacks and abuse of their interfaces. For example, frequent API calls by malicious users lead to soaring costs for businesses and SMS channel congestion. Furthermore, traditional verification code mechanisms have shortcomings in terms of timeliness and preventing duplicate sending. Verification codes have long validity periods, making them easy to intercept and use for illegal operations; the lack of strict sending frequency limits means that even with simple countdown timers on the front end, users can still bypass these limits by refreshing the page and repeatedly trigger sending requests.
[0003] Therefore, a method and device for preventing SMS verification code manipulation based on Redis are provided to solve the above problems. Summary of the Invention
[0004] The main objective of this invention is to address the shortcomings of existing technologies in traditional CAPTCHA mechanisms, such as timeliness and prevention of duplicate sending, the long validity period of CAPTCHAs making them easy to intercept and use for illegal operations, and the lack of strict sending frequency limits, which allow users to bypass restrictions and repeatedly trigger sending requests even with simple countdown limits on the front end.
[0005] The first aspect of this invention provides a Redis-based method for preventing SMS verification code interface fraud. The Redis-based method includes: obtaining mobile phone number information and verification code sending button activation information through a front-end page; checking the button status through the front-end page to perform front-end fraud prevention checks; receiving mobile phone number information through a back-end call to the SMS verification code sending interface to perform Redis fraud prevention checks; sending a verification code through a third-party SMS service via the back-end, and sending the verification code sending result through the back-end; receiving the verification code sending result sent by the back-end through the front-end, and generating a front-end prompt based on the verification code sending result; obtaining mobile phone number information and verification code information through the front-end page, and sending the mobile phone number information and verification code information to the back-end for verification.
[0006] Optionally, obtaining mobile phone number information and sending verification code button press information through the front-end page includes: the user enters a mobile phone number through the front-end page and clicks the send verification code button; the front-end page obtains mobile phone number information and send verification code button press information.
[0007] Optionally, the step of checking the button status through the front-end page to perform front-end anti-scraping checks includes: checking the button status on the front-end page; if the button status is disabled, preventing repeated clicks, generating a waiting prompt, and displaying the waiting prompt to the user; if the button status is available, allowing the sending of a "send verification code" request, and simultaneously starting a front-end countdown to disable the "send verification code" button.
[0008] Optionally, the step of receiving mobile phone number information through the backend call to the SMS verification code sending interface and performing Redis anti-fraud checks includes: the backend calls the SMS verification code sending interface to receive mobile phone number information; queries the SMS verification code sending interface from Redis; if data exists, the last sent verification code time is parsed to determine whether the time since the last sent verification code exceeds 60 seconds; if so, resending the verification code is allowed; otherwise, an error message is returned indicating that the request frequency is too high; when an old verification code exists in the SMS verification code sending interface and resending is allowed, the old verification code is deleted, a new verification code is generated and stored in Redis.
[0009] Optionally, the step of sending the verification code by calling a third-party SMS service through the backend, and sending the verification code sending result through the backend, includes: the backend calling the third-party SMS interface through ThirdPartFeignService; the third-party SMS service returning the sending result, which is either successful or failed; and the backend returning the result to the frontend page.
[0010] Optionally, the step of receiving the verification code sending result from the backend through the frontend and generating a frontend prompt based on the verification code sending result includes: the frontend receiving the verification code sending result from the backend; if the verification code sending result is successful, a verification code sending success prompt is displayed and the "verification code sending button" enters a 60-second countdown state; if the verification code sending result is unsuccessful, an error message is displayed and the user is allowed to resend.
[0011] Optionally, obtaining the mobile phone number and verification code information through the front-end page and sending the mobile phone number and verification code information to the back-end for verification includes: the user enters the mobile phone number and the received verification code in the registration form; the back-end retrieves the verification code information from Redis: if the verification code exists and matches, the registration is successful, and the verification code is deleted from Redis; if the verification code does not exist or does not match, the registration fails and the message "Verification code error" is displayed.
[0012] The second aspect of this invention provides a Redis-based anti-fraud device for SMS verification code interfaces. The Redis-based anti-fraud device includes: an SMS verification request module for obtaining mobile phone number information and verification code sending button press information through a front-end page; a front-end anti-fraud check module for checking the button status through the front-end page and performing front-end anti-fraud checks; a Redis anti-fraud check module for receiving mobile phone number information through a back-end call to the SMS verification code sending interface and performing Redis anti-fraud checks; a verification code sending module for sending a verification code through a back-end call to a third-party SMS service and sending the verification code sending result through the back-end; a sending result feedback module for receiving the verification code sending result sent by the back-end through the front-end and generating a front-end prompt based on the verification code sending result; and a verification code verification module for obtaining mobile phone number information and verification code information through the front-end page and sending the mobile phone number information and verification code information to the back-end for verification.
[0013] A third aspect of the present invention provides an electronic device, the electronic device including a memory and at least one processor, the memory storing instructions; the at least one processor invokes the instructions in the memory to cause the electronic device to perform the various steps of the Redis-based SMS verification code interface anti-fraud method as described above.
[0014] A fourth aspect of the present invention provides a computer-readable storage medium storing instructions that, when executed by a processor, implement the various steps of the Redis-based SMS verification code interface anti-fraud method described above.
[0015] In the technical solution of this invention, the introduction of a Redis-based SMS verification code anti-fraud system significantly improves the system's security, performance, and maintainability. Firstly, by centrally controlling the verification code sending time and validity period through Redis, a strict 60-second sending frequency limit and automated management of the verification code lifecycle are achieved, effectively preventing duplicate sending and verification code abuse. Secondly, the backend Redis-based rate limiting anti-fraud mechanism compensates for the vulnerability of frontend restrictions to page refreshes, greatly enhancing the system's ability to resist malicious script attacks and abnormally high-frequency requests. In terms of performance, Redis's high concurrency access capability reduces database pressure, making verification code verification and rate limiting operations more lightweight and efficient. Furthermore, by decoupling the verification code anti-fraud logic from the business logic, the system structure is clearer and scalability is significantly improved, providing space for the subsequent introduction of more complex risk control strategies. This solution significantly improves the security and stability of the verification code interface, resource utilization, and the overall service quality of the platform. Attached Figure Description
[0016] Figure 1 is a flowchart of the express delivery location reminder method provided in an embodiment of the present invention; Figure 2 is a structural schematic diagram of the express delivery location reminder device provided in an embodiment of the present invention; Figure 3 is a structural schematic diagram of the electronic device provided in an embodiment of the present invention. Detailed Implementation
[0017] This invention provides a Redis-based method for preventing SMS verification code spam, including: obtaining mobile phone number information and verification code sending button press information through a front-end page; checking the button status through the front-end page to perform front-end anti-scraping checks; receiving mobile phone number information through a back-end call to the SMS verification code sending interface to perform Redis anti-scraping checks; sending a verification code through a third-party SMS service through the back-end, and sending the verification code sending result through the back-end; receiving the verification code sending result sent by the back-end through the front-end, and generating a front-end prompt based on the verification code sending result; obtaining mobile phone number information and verification code information through the front-end page, and sending the mobile phone number information and verification code information to the back-end for verification. This invention solves the shortcomings of existing technologies, such as the inadequacy of traditional verification code mechanisms in terms of timeliness and anti-duplicate sending, the long validity period of verification codes making them easy to intercept and use for illegal operations, and the lack of strict sending frequency limits, which allow users to bypass restrictions and repeatedly trigger sending requests even with simple countdown limits on the front-end by refreshing the page.
[0018] The terms "first," "second," "third," "fourth," etc. (if present) in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" or "having" and any variations thereof are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0019] For ease of understanding, the specific process of the embodiments of the present invention is described below. Please refer to Figure 1. The first embodiment of the method for preventing SMS verification code interface fraud based on Redis in the embodiments of the present invention includes: obtaining mobile phone number information and verification code sending button press information through the front-end page; specifically, it includes: the user enters a mobile phone number through the front-end page and clicks the verification code sending button; the front-end page obtains mobile phone number information and verification code sending button press information.
[0020] The front-end page checks the button status to perform front-end anti-scraping checks. If the button is disabled, repeated clicks are prevented, a waiting prompt is generated, and displayed to the user. If the button is enabled, sending a "send verification code" request is allowed, and a front-end countdown is started to disable the "send verification code" button. This front-end design prevents users from bypassing the front-end verification code sending restriction by refreshing the page, thus improving security.
[0021] The system receives mobile phone number information by calling the SMS verification code sending interface on the backend and performs Redis anti-fraud checks; it sends verification codes by calling a third-party SMS service on the backend and sends the verification code sending results through the backend; the frontend receives the verification code sending results sent by the backend and generates frontend prompts based on the verification code sending results; the frontend obtains mobile phone number information and verification code information and sends them to the backend for verification.
[0022] Please refer to Figure 1. The second embodiment of the Redis-based SMS verification code interface anti-fraud method in this invention includes: obtaining mobile phone number information and verification code sending button press information through the front-end page; specifically, it includes: the user enters a mobile phone number through the front-end page and clicks the verification code sending button; the front-end page obtains the mobile phone number information and verification code sending button press information.
[0023] The front-end page checks the button status to perform front-end anti-scraping checks. If the button is disabled, repeated clicks are prevented, a waiting prompt is generated, and displayed to the user. If the button is enabled, sending a "send verification code" request is allowed, and a front-end countdown is started to disable the "send verification code" button. This front-end design prevents users from bypassing the front-end verification code sending restriction by refreshing the page, thus improving security.
[0024] The backend calls the SMS verification code sending interface to receive mobile phone number information and performs Redis anti-spam checks. Specifically, this includes: the backend calls the SMS verification code sending interface to receive mobile phone number information; it queries the SMS verification code sending interface from Redis; if data exists, it parses the last sent verification code time and determines if the time since the last sent verification code exceeds 60 seconds. If so, resending the verification code is allowed; otherwise, an error message indicating excessive request frequency is returned. When an old verification code exists in the SMS verification code sending interface and resending is allowed, the old verification code is deleted, a new verification code is generated, and stored in Redis. Managing all verification codes through Redis and unifying the refresh time enables strict time window control and automatic lifecycle maintenance of verification codes.
[0025] The system sends a verification code by calling a third-party SMS service from the backend, and then sends the verification code result through the backend. The frontend receives the verification code result sent by the backend and generates a prompt based on the result. The frontend obtains the phone number information and verification code information and sends them to the backend for verification.
[0026] Please refer to Figure 1. The third embodiment of the Redis-based SMS verification code interface anti-fraud method in this invention includes: obtaining mobile phone number information and verification code sending button press information through the front-end page; specifically, it includes: the user enters a mobile phone number through the front-end page and clicks the verification code sending button; the front-end page obtains the mobile phone number information and verification code sending button press information.
[0027] The front-end page checks the button status to perform front-end anti-scraping checks. If the button is disabled, repeated clicks are prevented, a waiting prompt is generated, and displayed to the user. If the button is enabled, sending a "send verification code" request is allowed, and a front-end countdown is started to disable the "send verification code" button. This front-end design prevents users from bypassing the front-end verification code sending restriction by refreshing the page, thus improving security.
[0028] The backend calls the SMS verification code sending interface to receive mobile phone number information and performs Redis anti-fraud checks. Specifically, this includes: the backend calls the SMS verification code sending interface to receive mobile phone number information; it queries the SMS verification code sending interface from Redis; if data exists, it parses the last sent verification code time and determines whether the time since the last sent verification code is more than 60 seconds. If so, it allows resending the verification code; otherwise, it returns an error message indicating that the request frequency is too high; when an old verification code exists in the SMS verification code sending interface and resending is allowed, the old verification code is deleted, a new verification code is generated and stored in Redis.
[0029] Managing all CAPTCHAs through Redis and unifying the refresh time enables strict time window control and automatic lifecycle maintenance for CAPTCHAs.
[0030] The verification code is sent by calling a third-party SMS service from the backend, and the verification code sending result is sent from the backend. Specifically, the backend calls the third-party SMS interface through ThirdPartFeignService; the third-party SMS service returns the sending result, which is either successful or failed; the backend returns the result to the frontend page.
[0031] The front-end receives the verification code sent by the back-end and generates a prompt based on the verification code. The front-end obtains the phone number and verification code information and sends them to the back-end for verification.
[0032] Please refer to Figure 1. The fourth embodiment of the Redis-based SMS verification code interface anti-fraud method in this invention includes: obtaining mobile phone number information and verification code sending button press information through the front-end page; specifically, it includes: the user enters a mobile phone number through the front-end page and clicks the verification code sending button; the front-end page obtains the mobile phone number information and verification code sending button press information.
[0033] The front-end page checks the button status to perform front-end anti-scraping checks. If the button is disabled, repeated clicks are prevented, a waiting prompt is generated, and displayed to the user. If the button is enabled, sending a "send verification code" request is allowed, and a front-end countdown is started to disable the "send verification code" button. This front-end design prevents users from bypassing the front-end verification code sending restriction by refreshing the page, thus improving security.
[0034] The backend calls the SMS verification code sending interface to receive mobile phone number information and performs Redis anti-fraud checks. Specifically, this includes: the backend calls the SMS verification code sending interface to receive mobile phone number information; it queries the SMS verification code sending interface from Redis; if data exists, it parses the last sent verification code time and determines whether the time since the last sent verification code is more than 60 seconds. If so, it allows resending the verification code; otherwise, it returns an error message indicating that the request frequency is too high; when an old verification code exists in the SMS verification code sending interface and resending is allowed, the old verification code is deleted, a new verification code is generated and stored in Redis.
[0035] Managing all CAPTCHAs through Redis and unifying the refresh time enables strict time window control and automatic lifecycle maintenance for CAPTCHAs.
[0036] The verification code is sent by calling a third-party SMS service from the backend, and the verification code sending result is sent from the backend. Specifically, the backend calls the third-party SMS interface through ThirdPartFeignService; the third-party SMS service returns the sending result, which is either successful or failed; the backend returns the result to the frontend page.
[0037] The system receives the verification code sending result from the backend via the frontend and generates a frontend prompt based on the result. Specifically, the frontend receives the verification code sending result from the backend. If the verification code is successfully sent, a success message is displayed and the "Verification Code Sending Button" enters a 60-second countdown. If the verification code fails to send, an error message is displayed, and the user is allowed to resend the code.
[0038] The system obtains the phone number and verification code information from the front-end page and sends them to the back-end for verification.
[0039] Please refer to Figure 1. The fifth embodiment of the Redis-based SMS verification code interface anti-fraud method in this invention includes: obtaining mobile phone number information and verification code sending button press information through the front-end page; specifically, it includes: the user enters a mobile phone number through the front-end page and clicks the verification code sending button; the front-end page obtains the mobile phone number information and verification code sending button press information.
[0040] The front-end page checks the button status to perform front-end anti-scraping checks. If the button is disabled, repeated clicks are prevented, a waiting prompt is generated, and displayed to the user. If the button is enabled, sending a "send verification code" request is allowed, and a front-end countdown is started to disable the "send verification code" button. This front-end design prevents users from bypassing the front-end verification code sending restriction by refreshing the page, thus improving security.
[0041] The backend calls the SMS verification code sending interface to receive mobile phone number information and performs Redis anti-fraud checks. Specifically, this includes: the backend calls the SMS verification code sending interface to receive mobile phone number information; it queries the SMS verification code sending interface from Redis; if data exists, it parses the last sent verification code time and determines whether the time since the last sent verification code is more than 60 seconds. If so, it allows resending the verification code; otherwise, it returns an error message indicating that the request frequency is too high; when an old verification code exists in the SMS verification code sending interface and resending is allowed, the old verification code is deleted, a new verification code is generated and stored in Redis.
[0042] Managing all CAPTCHAs through Redis and unifying the refresh time enables strict time window control and automatic lifecycle maintenance for CAPTCHAs.
[0043] The verification code is sent by calling a third-party SMS service from the backend, and the verification code sending result is sent from the backend. Specifically, the backend calls the third-party SMS interface through ThirdPartFeignService; the third-party SMS service returns the sending result, which is either successful or failed; the backend returns the result to the frontend page.
[0044] The system receives the verification code sending result from the backend via the frontend and generates a frontend prompt based on the result. Specifically, the frontend receives the verification code sending result from the backend. If the verification code is successfully sent, a success message is displayed and the "Verification Code Sending Button" enters a 60-second countdown. If the verification code fails to send, an error message is displayed, and the user is allowed to resend the code.
[0045] The system retrieves the user's phone number and verification code from the front-end page and sends them to the back-end for verification. Specifically, this involves: the user entering their phone number and the received verification code in a registration form; the back-end retrieving the verification code from Redis; if the verification code exists and matches, registration is successful, and the verification code is deleted from Redis; if the verification code does not exist or does not match, registration fails with the message "Verification code error".
[0046] Please refer to Figure 1. The sixth embodiment of the Redis-based SMS verification code interface anti-fraud method in this invention includes: obtaining mobile phone number information and verification code sending button press information through the front-end page; specifically, it includes: the user enters a mobile phone number through the front-end page and clicks the verification code sending button; the front-end page obtains the mobile phone number information and verification code sending button press information.
[0047] The front-end page checks the button status to perform front-end anti-scraping checks. If the button is disabled, repeated clicks are prevented, a waiting prompt is generated, and displayed to the user. If the button is enabled, sending a "send verification code" request is allowed, and a front-end countdown is started to disable the "send verification code" button. This front-end design prevents users from bypassing the front-end verification code sending restriction by refreshing the page, thus improving security.
[0048] The backend calls the SMS verification code sending interface to receive mobile phone number information and performs Redis anti-fraud checks. Specifically, this includes: the backend calls the SMS verification code sending interface to receive mobile phone number information; it queries the SMS verification code sending interface from Redis; if data exists, it parses the last sent verification code time and determines if the time since the last sent verification code is more than 60 seconds. If so, it allows resending the verification code; otherwise, it returns an error message indicating excessive request frequency. When an old verification code exists in the SMS verification code sending interface and resending is allowed, the old verification code is deleted, and a new verification code is generated and stored in Redis. The stored values include: key: sms:code:{phone}; value:{code}_{timestamp}; expire: 10 minutes. These values are used to verify the validity period of the verification code during subsequent registration. The validity period of the verification code can also be modified by changing the expire value.
[0049] Managing all CAPTCHAs through Redis and unifying the refresh time enables strict time window control and automatic lifecycle maintenance for CAPTCHAs.
[0050] The verification code is sent by calling a third-party SMS service from the backend, and the verification code sending result is sent from the backend. Specifically, the backend calls the third-party SMS interface through ThirdPartFeignService; the third-party SMS service returns the sending result, which is either successful or failed; the backend returns the result to the frontend page.
[0051] The system receives the verification code sending result from the backend via the frontend and generates a frontend prompt based on the result. Specifically, the frontend receives the verification code sending result from the backend. If the verification code is successfully sent, a success message is displayed and the "Verification Code Sending Button" enters a 60-second countdown. If the verification code fails to send, an error message is displayed, and the user is allowed to resend the code.
[0052] The system retrieves the user's phone number and verification code from the front-end page and sends them to the back-end for verification. Specifically, this involves: the user entering their phone number and the received verification code in a registration form; the back-end retrieving the verification code from Redis; if the verification code exists and matches, registration is successful, and the verification code is deleted from Redis; if the verification code does not exist or does not match, registration fails with the message "Verification code error".
[0053] The above describes the Redis-based SMS verification code interface anti-fraud method in the embodiments of the present invention. The following describes the Redis-based SMS verification code interface anti-fraud device in the embodiments of the present invention. Referring to Figure 2, the Redis-based SMS verification code interface anti-fraud device in the embodiments of the present invention includes: an SMS verification request module 201, used to obtain mobile phone number information and verification code sending button press information through a front-end page; a front-end anti-fraud check module 202, used to check the button status through a front-end page and perform front-end anti-fraud checks; a Redis anti-fraud check module 203, used to receive mobile phone number information through a back-end call to the SMS verification code sending interface and perform Redis anti-fraud checks; a verification code sending module 204, used to send a verification code through a back-end call to a third-party SMS service and send the verification code sending result through the back-end; a sending result feedback module 205, used to receive the verification code sending result sent by the back-end through the front-end and generate a front-end prompt based on the verification code sending result; and a verification code verification module 206, used to obtain mobile phone number information and verification code information through a front-end page and send the mobile phone number information and verification code information to the back-end for verification.
[0054] Figure 2 above describes the Redis-based SMS verification code interface anti-fraud device in this embodiment of the invention from the perspective of modular functional entities. The following describes the electronic device in this embodiment of the invention from the perspective of hardware processing.
[0055] Figure 3 is a schematic diagram of an electronic device 700 provided in an embodiment of the present invention. The electronic device 700 can vary considerably depending on its configuration or performance, and may include one or more processors 710 (e.g., one or more processors) and a memory 720, and one or more storage media 730 (e.g., one or more storage devices, including RAM, FLASH, etc.) for storing application programs 733 or data 732. The memory 720 and storage media 730 can be temporary or persistent storage. The program stored in the storage media 730 may include one or more modules (not shown in the figure), each module including a series of instruction operations on the electronic device 700. Furthermore, the processor 710 may be configured to communicate with the storage media 730 and execute the series of instruction operations in the storage media 730 on the electronic device 700.
[0056] Electronic device 700 may also include one or more power supplies 740, one or more input / output interfaces 750, and / or one or more operating systems 731, such as FreeRTOS, Android, etc. Those skilled in the art will understand that the electronic device structure shown in FIG3 does not constitute a limitation on electronic devices and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0057] The present invention also provides a computer-readable storage medium, which can be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. The computer-readable storage medium stores instructions that, when executed on a computer, cause the computer to perform the steps of a Redis-based SMS verification code interface anti-fraud method.
[0058] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the system, device, or unit described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0059] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, mobile device, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0060] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for preventing SMS verification code API fraud based on Redis, characterized in that, The Redis-based SMS verification code API anti-fraud method includes: obtaining mobile phone number information and verification code send button press information through the front-end page; checking the button status through the front-end page to perform front-end anti-fraud checks; receiving mobile phone number information through the back-end SMS verification code sending API to perform Redis anti-fraud checks; sending the verification code through the back-end by calling a third-party SMS service, and sending the verification code sending result through the back-end; receiving the verification code sending result sent by the back-end through the front-end, and generating a front-end prompt based on the verification code sending result; obtaining mobile phone number information and verification code information through the front-end page, and sending the mobile phone number information and verification code information to the back-end for verification.
2. The method for preventing SMS verification code interface fraud based on Redis according to claim 1, characterized in that, The process of obtaining mobile phone number information and sending verification code button press information through the front-end page includes: the user enters a mobile phone number through the front-end page and clicks the send verification code button; the front-end page obtains mobile phone number information and send verification code button press information.
3. The method for preventing SMS verification code interface fraud based on Redis according to claim 1, characterized in that, The front-end anti-scraping check by checking the button status on the front-end page includes: checking the button status on the front-end page; if the button status is disabled, preventing repeated clicks, generating a waiting prompt, and displaying the waiting prompt to the user; if the button status is available, allowing the sending of a "send verification code" request, and simultaneously starting a front-end countdown to disable the "send verification code" button.
4. The method for preventing SMS verification code interface fraud based on Redis according to claim 1, characterized in that, The process of receiving mobile phone number information via a backend call to the SMS verification code sending interface and performing Redis anti-fraud checks includes: the backend calls the SMS verification code sending interface to receive mobile phone number information; it queries the SMS verification code sending interface from Redis, and if data exists, it parses the last sent verification code time and determines whether the time since the last sent verification code is more than 60 seconds away. If so, it allows resending the verification code; otherwise, it returns an error message indicating that the request frequency is too high; when an old verification code exists in the SMS verification code sending interface and resending is allowed, the old verification code is deleted, a new verification code is generated, and stored in Redis.
5. The method for preventing SMS verification code manipulation based on Redis according to claim 1, characterized in that, The process of sending a verification code by calling a third-party SMS service through the backend, and sending the verification code result through the backend, includes: the backend calling the third-party SMS interface through ThirdPartFeignService; the third-party SMS service returning the sending result, which is either successful or failed; and the backend returning the result to the frontend page.
6. The method for preventing SMS verification code interface fraud based on Redis according to claim 1, characterized in that, The process of receiving the verification code sending result from the backend through the frontend and generating a frontend prompt based on the verification code sending result includes: the frontend receives the verification code sending result from the backend; if the verification code sending result is successful, a verification code sending success prompt is displayed, and the "Verification Code Sending Button" enters a 60-second countdown state; if the verification code sending result is unsuccessful, an error message is displayed, and the user is allowed to resend.
7. The method for preventing SMS verification code interface fraud based on Redis according to claim 1, characterized in that, The process of obtaining mobile phone number and verification code information through the front-end page and sending them to the back-end for verification includes: the user entering their mobile phone number and the received verification code in the registration form; the back-end retrieving the verification code information from Redis: if the verification code exists and matches, registration is successful, and the verification code is deleted from Redis; if the verification code does not exist or does not match, registration fails and the message "Verification code error" is displayed.
8. A Redis-based SMS verification code interface anti-fraud device, used in the Redis-based SMS verification code interface anti-fraud method as described in any one of claims 1-7, characterized in that, include: The SMS verification request module is used to obtain mobile phone number information and verification code sending button activation information from the front-end page; The front-end anti-fraud module checks the button status on the front-end page to perform front-end anti-fraud checks; the Redis anti-fraud module receives mobile phone number information by calling the SMS verification code sending interface on the back-end to perform Redis anti-fraud checks; the verification code sending module sends verification codes by calling a third-party SMS service on the back-end and sends the verification code sending result through the back-end; the sending result feedback module receives the verification code sending result sent by the back-end on the front-end and generates a front-end prompt based on the verification code sending result. The verification code verification module is used to obtain mobile phone number information and verification code information from the front-end page and send the mobile phone number information and verification code information to the back-end for verification.
9. An electronic device comprising a memory and at least one processor, wherein the memory stores instructions; characterized in that, The at least one processor invokes the instructions in the memory to cause the electronic device to perform the steps of the Redis-based SMS verification code interface anti-fraud method as described in any one of claims 1-7.
10. A computer-readable storage medium storing instructions thereon, characterized in that, When the instruction is executed by the processor, it implements each step of the Redis-based SMS verification code interface anti-fraud method as described in any one of claims 1-7.