A method, device, terminal equipment and storage medium for adding a verification function

By generating a list of verification rules and a verification code interface, the problem of repeatedly writing code in existing technologies is solved, and the development efficiency of the verification code function is improved.

CN117270950BActive Publication Date: 2026-11-27GUANGZHOU LANGO ELECTRONICS TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311245598.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-25
Publication Date
2026-11-27
Estimated Expiration
2043-09-25

AI Technical Summary

Technical Problem

Existing technologies require rewriting code when adding verification functions in different scenarios, resulting in low development efficiency.

Method used

By obtaining the target URL that needs to be verified and its verification rules, a list of verification rules is generated, and a verification code interface is generated in response to user access requests. This interface includes components for entering mobile phone numbers and verification codes. The verification code interface is generated according to the verification rules and compared, reducing repetitive code writing.

Benefits of technology

It improves the development efficiency of adding verification codes, reduces repetitive code operations, and enhances overall development efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117270950B_ABST
    Figure CN117270950B_ABST
Patent Text Reader

Abstract

The application discloses a method, device, terminal equipment and storage medium for adding a verification function, and the method comprises the following steps: acquiring a plurality of target URLs that need to be added with verification and a verification rule of each target URL; generating a verification rule list according to all the target URLs and the verification rule of each target URL; acquiring a first URL corresponding to a user access request in response to the user access request; comparing the first URL with the target URLs in the verification rule list, determining a target URL consistent with the first URL as a second URL when the comparison is consistent, and generating a verification code interface according to the second URL and the corresponding verification rule; wherein the verification code interface comprises a first component for inputting a mobile phone number, a second component for inputting a verification code, a third component for requesting a verification code, and a fourth component for submitting a verification code. The application can improve the development efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and in particular to a method, apparatus, terminal device, and storage medium for adding verification functionality. Background Technology

[0002] In software development in the field of computer technology, user access permissions are often determined through authentication. Therefore, authentication functionality needs to be added where user access verification is required. In existing technologies, the method for adding authentication functionality typically involves determining the required authentication node and authentication type, and then directly writing the corresponding authentication code into the development code. For example, when adding a login verification code function to a webpage, the corresponding code to implement the login verification function is directly written into the development code of that page, so that the program executes the written code to complete the authentication. However, this method of implementing authentication functionality by writing authentication code requires repeating the code writing operation for different use cases, consuming a lot of time and manpower, resulting in low development efficiency. Summary of the Invention

[0003] This invention provides a method, apparatus, terminal device, and storage medium for adding verification functions, which can solve the problem of low development efficiency in the prior art where code needs to be repeatedly written to implement verification functions in different scenarios, and improve the development efficiency of adding verification code functions.

[0004] An embodiment of the present invention provides a method for adding verification functionality, comprising:

[0005] Obtain the target URLs that need to be verified and the verification rules for each target URL;

[0006] A list of verification rules is generated based on all the target URLs and the verification rules for each target URL;

[0007] Respond to the user's access request and obtain the first URL corresponding to the user's access request;

[0008] The first URL is compared with the target URL in the verification rule list. If they match, the target URL that matches the first URL is determined as the second URL, and a verification code interface is generated according to the second URL and the corresponding verification rule. The verification code interface includes a first component for entering a mobile phone number, a second component for entering a verification code, a third component for requesting a verification code, and a fourth component for submitting a verification code.

[0009] Furthermore, the verification rules include: mobile phone number can be modified, mobile phone number cannot be modified, or automatic verification;

[0010] The step of generating a verification code interface based on the second URL and the corresponding verification rules includes:

[0011] When the verification rule allows for modification of the mobile phone number, the generated verification code interface includes an editable first component;

[0012] When the verification rule is that the mobile phone number cannot be modified, the generated verification code interface contains a first component that cannot be edited;

[0013] When the verification rule is automatic verification, the current user's login mobile phone number is obtained; if the current user's login mobile phone number is successfully obtained, the generated verification code interface includes a first component with the current user's login mobile phone number as the first component.

[0014] Furthermore, it also includes:

[0015] In response to the user's click operation on the third component on the verification code interface, the system obtains the current user's mobile phone number and generates a first verification code based on the current user's mobile phone number.

[0016] In response to the user's click operation on the fourth component on the verification code interface, the corresponding second verification code is obtained;

[0017] Compare the first verification code and the second verification code;

[0018] When the second verification code matches the first verification code, the user is granted permission to execute subsequent business logic;

[0019] If the second verification code does not match the first verification code, an error message will be sent to the user.

[0020] Furthermore, the list of verification rules is in JSON format.

[0021] Based on the above method embodiments, the present invention provides corresponding apparatus embodiments;

[0022] One embodiment of the present invention provides a device for adding verification functionality, comprising: a data acquisition module, a verification rule list generation module, and a verification code interface generation module;

[0023] The data acquisition module is used to acquire several target URLs that need to be verified and the verification rules for each target URL;

[0024] The verification rule list generation module is used to generate a verification rule list based on all the target URLs and the verification rules for each target URL;

[0025] The verification code interface generation module is used to respond to user access requests, obtain the first URL corresponding to the user access request, compare the first URL with the target URL in the verification rule list, and when the comparison is consistent, determine the target URL consistent with the first URL as the second URL, and generate a verification code interface according to the second URL and the corresponding verification rules; wherein, the verification code interface includes a first component for entering a mobile phone number, a second component for entering a verification code, a third component for requesting a verification code, and a fourth component for submitting a verification code.

[0026] Furthermore, the verification rules include: mobile phone number can be modified, mobile phone number cannot be modified, or automatic verification;

[0027] The step of generating a verification code interface based on the second URL and the corresponding verification rules includes:

[0028] When the verification rule allows for modification of the mobile phone number, the generated verification code interface includes an editable first component;

[0029] When the verification rule is that the mobile phone number cannot be modified, the generated verification code interface contains a first component that cannot be edited;

[0030] When the verification rule is automatic verification, the current user's login mobile phone number is obtained; if the current user's login mobile phone number is successfully obtained, the generated verification code interface includes a first component containing the current user's login mobile phone number.

[0031] Furthermore, it also includes: a verification module;

[0032] The verification module is configured to respond to a user's click operation on the third component on the verification code interface, obtain the current user's mobile phone number, and generate a first verification code based on the current user's mobile phone number; respond to a user's click operation on the fourth component on the verification code interface, and obtain a corresponding second verification code; compare the first verification code and the second verification code; when the second verification code matches the first verification code, grant the user permission to execute subsequent business logic; when the second verification code does not match the first verification code, provide the user with a verification code error message.

[0033] Furthermore, the list of verification rules is in JSON format.

[0034] Another embodiment of the present invention provides a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor executes the computer program to implement a method for adding a verification function as described in the above-described embodiment of the invention.

[0035] Another embodiment of the present invention provides a storage medium including a stored computer program, wherein, when the computer program is executed, it controls the device where the storage medium is located to perform a method for adding a verification function as described in the above-described embodiment of the invention.

[0036] The following benefits can be obtained by implementing the present invention:

[0037] This invention provides a method, apparatus, terminal device, and storage medium for adding verification functionality. The method involves acquiring multiple target URLs for which verification codes need to be added, determining the verification rules corresponding to each target URL, generating a verification rule list from the target URLs and verification rules, and monitoring user access requests. The method compares a first URL corresponding to the user's access request with URLs in the verification rule list. If a URL is found in the list, a second URL and corresponding verification rules are retrieved from the list based on the user's access request. Then, the method for adding a verification code is determined based on the second URL and verification rules, and a corresponding verification code interface is generated, allowing the user to complete the verification process. By constructing a verification rule list, only the URLs for which verification code functionality needs to be added and their corresponding verification rules need to be configured in the list, eliminating the need for repetitive code development and improving development efficiency when adding verification code functionality. Attached Figure Description

[0038] Figure 1 This is a flowchart illustrating a method for adding verification functionality according to an embodiment of the present invention.

[0039] Figure 2 This is a schematic diagram of a device for adding verification function according to an embodiment of the present invention. Detailed Implementation

[0040] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0041] like Figure 1 The image shows a method for adding verification functionality according to an embodiment of the present invention, comprising:

[0042] Step S1: Obtain several target URLs that need to be verified and the verification rules for each target URL;

[0043] Step S2: Generate a list of verification rules based on all the target URLs and the verification rules for each target URL;

[0044] Step S3: Respond to the user's access request and obtain the first URL corresponding to the user's access request;

[0045] Step S4: Compare the first URL with the target URL in the verification rule list. If they match, determine the target URL that matches the first URL as the second URL, and generate a verification code interface based on the second URL and the corresponding verification rule.

[0046] The verification code interface includes a first component for entering a mobile phone number, a second component for entering a verification code, a third component for requesting a verification code, and a fourth component for submitting the verification code.

[0047] For step S1, obtain multiple URLs that need to be added to the verification function (i.e., the target URLs mentioned above), and determine the verification rules corresponding to each URL during verification.

[0048] For step S2, generate a list of verification rules based on the multiple URLs for which verification functions need to be added and the verification rules corresponding to each URL.

[0049] It's important to note that to avoid wasting computing power by repeatedly generating verification rule lists when adding, modifying, or deleting URLs or verification rules later, a verification rule list is generated initially. Subsequent operations on adding, modifying, or deleting URLs or verification rules are all based on this generated list, avoiding repeated list generation. Furthermore, the generated verification rule list should be synchronized between the front-end and back-end of the system, and validation should be performed on the same rules in both. For example, if an access request URL obtained in the front-end is not in the verification rule list, the back-end must also check its verification rules when obtaining the access request URL from the front-end. If it is not in the verification rule list, the URL request should not be validated.

[0050] In a preferred embodiment, the list of verification rules is in JSON format.

[0051] Specifically, the validation rule list uses a JSON array format, and a single JSON array can store multiple URLs. Each URL is stored in the array along with its associated validation rule.

[0052] For step S3, respond to the user's access request and obtain the URL accessed by the user when the access request is made (i.e., the first URL mentioned above).

[0053] For step S4, check if the URL of the current user's access request is a URL that requires verification as determined in the verification rule list. If not, the URL of the access request is a URL that does not require verification, and the user does not need to be presented with a verification code interface to request verification when accessing this URL. If so, search for the URL that is the same as the user's access URL in the verification rule list (i.e., the second URL mentioned above), then determine the corresponding verification rule in the JSON array according to the URL in the verification rule list, and generate the corresponding verification code interface. The verification code interface includes a first component for entering a mobile phone number, a second component for entering a verification code, a third component for requesting a verification code, and a fourth component for submitting the verification code.

[0054] In a preferred embodiment, the verification rules include: a modifiable mobile phone number, an unmodifiable mobile phone number, or automatic verification; generating a verification code interface based on the second URL and the corresponding verification rules includes: when the verification rule is a modifiable mobile phone number, the generated verification code interface includes an editable first component; when the verification rule is an unmodifiable mobile phone number, the generated verification code interface includes an uneditable first component; when the verification rule is automatic verification, obtaining the current user's login mobile phone number; if obtaining the current user's login mobile phone number is successful, the generated verification code interface includes a first component where the mobile phone number is the current user's login mobile phone number.

[0055] Specifically, when setting verification rules, it's common practice to choose one of the following: allowing modification of the phone number (Y), prohibiting modification of the phone number (N), or automatic verification (A). For example: the login request URL is " / auth / login", with automatic verification rule A; the SMS verification URL is " / sms / check", with the verification rule allowing modification of the phone number (Y); and the password change URL is " / auth / forgetPwd", with the verification rule prohibiting modification of the phone number (N). The resulting list of verification rules based on these three URLs would be as follows:

[0056] [{"url":" / auth / login","editableFlag":"A"},

[0057] {"url":" / sms / check","editableFlag":"Y"},

[0058] {"url":" / auth / forgetPwd","editableFlag":"N"}],

[0059] Here, `editableFlag` represents the verification rule, and `url` is the target URL to which verification needs to be added. By setting the verification rules for URLs corresponding to different scenarios, i.e., by setting the value of the `editableFlag` parameter, different verification functions can be presented in URLs corresponding to different scenarios.

[0060] The `{"url":" / auth / login","editableFlag":"A"}` indicates that the login verification rule is automatic. This means the backend retrieves the mobile phone number used by the current user to log in. If the backend successfully retrieves the user's login mobile phone number, the current user is considered not a new user, and the backend will verify the user's login based on the mobile phone number used during login. Furthermore, the verification code interface generated on the frontend should include the current mobile phone number. If the current user's login mobile phone number cannot be retrieved, the current user is considered a new user, and no request for mobile phone number verification or generation of a verification code interface is needed; the user is directly granted the corresponding access permissions.

[0061] The `{"url":" / sms / check","editabtleFlag":"Y"}` indicates that in the pop-up SMS verification window, the user can freely enter and modify their mobile phone number. The target mobile phone number for sending the verification code is then determined based on the final modified or entered number. Therefore, the verification code interface generated in the front-end should include an editable mobile phone number component.

[0062] The value {"url":" / auth / forgetPwd","editableFlag":"N"} indicates that the phone number is uneditable in the password modification scenario, and verification can only be performed using the currently bound phone number. Therefore, the verification code interface generated in the front end should include a component representing the uneditable phone number.

[0063] The above are examples of usage scenarios adapted to the three verification rules in this embodiment. In actual application, the list of verification rules can be expanded by adding new verification rules and target URLs, so that the final list of verification rules can be more widely adapted to a variety of different verification scenarios, thereby improving the efficiency of adding verification functions in different scenarios.

[0064] In a preferred embodiment, the method further includes: responding to a user's click operation on the third component on the verification code interface, obtaining the current user's mobile phone number, and generating a first verification code based on the current user's mobile phone number; responding to a user's click operation on the fourth component on the verification code interface, obtaining a corresponding second verification code; comparing the first verification code and the second verification code; granting the user permission to execute subsequent business logic when the second verification code matches the first verification code; and providing the user with a verification code error message when the second verification code does not match the first verification code.

[0065] Specifically, after a user enters or automatically obtains their mobile phone number on the verification code interface, and initiates a verification code request by clicking the component corresponding to the request verification code on the interface, the backend obtains the corresponding mobile phone number and generates a verification code (i.e., the first verification code mentioned above) based on the obtained mobile phone number, and sends it to the user. The user then enters the verification code (i.e., the second verification code mentioned above) in the component corresponding to the input verification code based on the received verification code, and transmits the input verification code to the backend by clicking the submit verification code component on the interface. The backend then compares the first verification code and the second verification code to verify whether the user's verification code is entered correctly. If it is incorrect, the user is notified that the verification code was entered incorrectly; if it is correct, the verification is passed and the corresponding access permissions are granted.

[0066] Based on the above method embodiments, the present invention provides corresponding apparatus embodiments.

[0067] like Figure 2 As shown, an embodiment of the present invention provides a device for adding verification functionality, including: a data acquisition module, a verification rule list generation module, and a verification code interface generation module;

[0068] The data acquisition module is used to acquire several target URLs that need to be verified and the verification rules for each target URL;

[0069] The verification rule list generation module is used to generate a verification rule list based on all the target URLs and the verification rules for each target URL;

[0070] The verification code interface generation module is used to respond to user access requests, obtain the first URL corresponding to the user access request, compare the first URL with the target URL in the verification rule list, and when the comparison is consistent, determine the target URL consistent with the first URL as the second URL, and generate a verification code interface according to the second URL and the corresponding verification rules; wherein, the verification code interface includes a first component for entering a mobile phone number, a second component for entering a verification code, a third component for requesting a verification code, and a fourth component for submitting a verification code.

[0071] In a preferred embodiment, the verification rules include: a modifiable mobile phone number, an unmodifiable mobile phone number, or automatic verification;

[0072] A verification code interface is generated based on the second URL and the corresponding verification rules, including:

[0073] When the verification rule allows for modification of the mobile phone number, the generated verification code interface includes an editable first component;

[0074] When the verification rule is that the mobile phone number cannot be modified, the generated verification code interface contains a first component that cannot be edited;

[0075] When the verification rule is automatic verification, the current user's login mobile phone number is obtained; if the current user's login mobile phone number is successfully obtained, the generated verification code interface includes a first component with the current user's login mobile phone number as the first component.

[0076] In a preferred embodiment, it further includes: a verification module;

[0077] The verification module is configured to respond to a user's click operation on the third component on the verification code interface, obtain the current user's mobile phone number, and generate a first verification code based on the current user's mobile phone number; respond to a user's click operation on the fourth component on the verification code interface, and obtain a corresponding second verification code; compare the first verification code and the second verification code; when the second verification code matches the first verification code, grant the user permission to execute subsequent business logic; when the second verification code does not match the first verification code, provide the user with a verification code error message.

[0078] In a preferred embodiment, the list of verification rules is in JSON format.

[0079] It should be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Furthermore, in the accompanying drawings of the device embodiments provided by this invention, the connection relationships between modules indicate that they have communication connections, which can be specifically implemented as one or more communication buses or signal lines. Those skilled in the art can understand and implement this without any creative effort.

[0080] Those skilled in the art will clearly understand that, for convenience and brevity, the specific working process of the device described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0081] Based on the above method embodiments, the present invention provides corresponding terminal device embodiments.

[0082] One embodiment of the present invention provides a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements a method for adding a verification function as described in any one of the present invention.

[0083] The terminal device can be a desktop computer, laptop, handheld computer, or cloud server, etc. The terminal device may include, but is not limited to, a processor and a memory.

[0084] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor. The processor is the control center of the terminal device, connecting all parts of the terminal device via various interfaces and lines.

[0085] The memory can be used to store the computer program. The processor implements various functions of the terminal device by running or executing the computer program stored in the memory and calling data stored in the memory. The memory may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function, etc.; the data storage area may store data created based on the use of the mobile phone, etc. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, RAM, plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.

[0086] Based on the above method embodiments, the present invention provides corresponding storage medium embodiments.

[0087] One embodiment of the present invention provides a storage medium including a stored computer program, wherein, when the computer program is executed, it controls the device where the storage medium is located to execute a method for adding a verification function as described in any one of the present invention.

[0088] The storage medium is a computer-readable storage medium, and the computer program is stored in the computer-readable storage medium. When executed by a processor, the computer program can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium, etc.

[0089] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications are also considered to be within the scope of protection of the present invention.

Claims

1. A method for adding verification functionality, characterized in that, include: Obtain the target URLs that need to be verified and the verification rules for each target URL; A list of verification rules is generated based on all the target URLs and the verification rules for each target URL; Respond to the user's access request and obtain the first URL corresponding to the user's access request; The first URL is compared with the target URL in the verification rule list. If they match, the target URL that matches the first URL is determined as the second URL, and a verification code interface is generated according to the second URL and the corresponding verification rule. The verification code interface includes a first component for entering a mobile phone number, a second component for entering a verification code, a third component for requesting a verification code, and a fourth component for submitting a verification code; the verification rules include: mobile phone number can be modified, mobile phone number cannot be modified, or automatic verification; A verification code interface is generated based on the second URL and the corresponding verification rules, including: When the verification rule allows for modification of the mobile phone number, the generated verification code interface includes an editable first component; When the verification rule is that the mobile phone number cannot be modified, the generated verification code interface contains a first component that cannot be edited; When the verification rule is automatic verification, the current user's login mobile phone number is obtained; if the current user's login mobile phone number is successfully obtained, the generated verification code interface includes a first component containing the current user's login mobile phone number.

2. The method for adding verification functionality as described in claim 1, characterized in that, Also includes: In response to the user's click operation on the third component on the verification code interface, the system obtains the current user's mobile phone number and generates a first verification code based on the current user's mobile phone number. In response to the user's click operation on the fourth component on the verification code interface, the corresponding second verification code is obtained; Compare the first verification code and the second verification code; When the second verification code matches the first verification code, the user is granted permission to execute subsequent business logic; If the second verification code does not match the first verification code, an error message will be sent to the user.

3. The method for adding verification functionality as described in claim 1, characterized in that, The list of verification rules is in JSON format.

4. A device for adding verification functionality, characterized in that, include: Data acquisition module, verification rule list generation module, and verification code interface generation module; The data acquisition module is used to acquire several target URLs that need to be verified and the verification rules for each target URL; The verification rule list generation module is used to generate a verification rule list based on all the target URLs and the verification rules for each target URL; The verification code interface generation module is used to respond to user access requests and obtain the first URL corresponding to the user access request; The first URL is compared with the target URLs in the verification rule list. If they match, the target URL matching the first URL is determined as the second URL, and a verification code interface is generated according to the second URL and the corresponding verification rules. The verification code interface includes a first component for inputting a mobile phone number, a second component for inputting a verification code, a third component for requesting a verification code, and a fourth component for submitting a verification code. The verification rules include: mobile phone number can be modified, mobile phone number cannot be modified, or automatic verification. Generating the verification code interface according to the second URL and the corresponding verification rules includes: when the verification rule is that the mobile phone number can be modified, the generated verification code interface includes an editable first component; when the verification rule is that the mobile phone number cannot be modified, the generated verification code interface includes a non-editable first component; when the verification rule is automatic verification, the current user's login mobile phone number is obtained; if the current user's login mobile phone number is successfully obtained, the generated verification code interface includes a first component containing the current user's login mobile phone number.

5. The apparatus for adding a verification function as described in claim 4, characterized in that, Also includes: Verification module; The verification module is configured to respond to a user's click operation on the third component on the verification code interface, obtain the current user's mobile phone number, and generate a first verification code based on the current user's mobile phone number; respond to a user's click operation on the fourth component on the verification code interface, and obtain a corresponding second verification code; compare the first verification code and the second verification code; when the second verification code matches the first verification code, grant the user permission to execute subsequent business logic; when the second verification code does not match the first verification code, provide the user with a verification code error message.

6. The apparatus for adding a verification function as described in claim 4, characterized in that, The list of verification rules is in JSON format.

7. A terminal device, characterized in that, The system includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor, when executing the computer program, implements a method for adding a verification function as described in any one of claims 1 to 3.

8. A storage medium, characterized in that, The storage medium includes a stored computer program, wherein, when the computer program is executed, it controls the device where the storage medium is located to perform a method for adding a verification function as described in any one of claims 1 to 3.

Citation Information

Patent Citations

  • Method and device for verifying identifying code

    CN106572074A

  • Zero-trust network access request processing method and apparatus, and electronic device

    CN115701019A