Verification code generation method, verification code verification method, device, equipment and medium
By generating multiple character verification codes on the server and gradually verifying, ensuring that the next login will be carried out after each verification is successful, solving the problem that verification codes are easily cracked in the existing technology and improving the security of user identity verification.
Patent Information
- Application Number
- CN202210870251.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-18
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2042-07-18
AI Technical Summary
In the existing verification code technology, users can easily be brute-for-fighted by hackers, resulting in user information leakage and reducing the security of user identity authentication.
Generate multiple character verification codes through the server, and send the verification code of the next character position to the client after each verification is successful. Until the verification code of the last character position is successfully verified, ensuring that each verification is successful, it is not done after the verification is successful. One-step login request to improve the security of verification.
It effectively avoids the problem of hackers obtaining verification code information to automatically log in through brute force, and improves the security of user identity verification.
Smart Images

Figure CN115174122B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of Internet security technology, and in particular to a verification code generation method, a verification code verification method, a device, a equipment and a medium. Background Art
[0002] With the development of Internet technology and the widespread use of software applications, web pages and systems, in order to ensure the security of users logging into software applications, web pages and systems, verification code technology has been widely used in system login, user identity authentication, etc., verification code (Completely Automated Public Turing test to tell Computers and Humans Apart, CAPTCHA) is the abbreviation of the Turing test to tell Computers and Humans Apart. It is a public fully automatic program to distinguish whether the user is a computer or a human, which can effectively prevent malicious password cracking, ticket swiping, forum flooding and other network security issues.
[0003] In the prior art, users usually verify their identity by obtaining verification code information such as a static image verification code, a character verification code, or a behavior verification code at one time, thereby successfully logging into software applications, web pages, and systems.
[0004] However, with the existing technology, since the user only uses the verification code information obtained once to verify the login, it is easy for hackers to brute force crack the verification code information to achieve automatic login, thereby leaking the user's information and reducing the security of user identity authentication. Summary of the invention
[0005] Based on this, it is necessary to provide a verification code generation method, verification code verification method, device, equipment and medium to address the above technical problems.
[0006] In a first aspect of an embodiment of the present disclosure, a verification code generation method is provided, which is applied to a server, and the method includes:
[0007] In response to a first verification code login request sent by a client, generate a first verification code with N character digits, and send the first verification code to the client, wherein the first verification code carries a first verification code identifier and a character identifier corresponding to each character constituting the first verification code;
[0008] receiving a first target character verification code and a first target character identifier sent by the client, and when it is determined, based on the first target character identifier, that the first target character verification code is consistent with the first character in the first verification code, verifying success and sending a first verification success prompt to the client, so that the client sends a second verification code login request to the server;
[0009] In response to a second verification code login request sent by the client, generating a second character verification code, and sending the second character verification code to the client;
[0010] receiving a second target character verification code and a second target character identifier sent by the client, and when it is determined that the second target character verification code is consistent with the second character verification code according to the second target character identifier, verifying success and sending a second verification success prompt to the client, so that the client sends a verification code login request corresponding to the next character position to the server, until the client sends the Nth verification code login request to the server;
[0011] In response to the Nth verification code login request sent by the client, generate an Nth character verification code, and send the Nth character verification code to the client;
[0012] Receive the Nth target character verification code and the Nth target character identifier sent by the client, and based on the Nth target character identifier, when it is determined that the Nth target character verification code is consistent with the Nth character verification code, verify successfully and send an Nth verification success prompt to the client, wherein the Nth verification success prompt enables the client to successfully log in to the target object.
[0013] In one embodiment, in response to the second verification code login request sent by the client, generating a second character verification code and sending the second character verification code to the client includes:
[0014] In response to the second verification code login request sent by the client, determining a target preset range within a preset range set;
[0015] After determining the target preset range, selecting any character within the target preset range to determine the second character verification code, and sending the second character verification code to the client, wherein the second character verification code carries a second target character identifier; or
[0016] The step of generating an N-character verification code in response to the N-th verification code login request sent by the client, and sending the N-character verification code to the client includes:
[0017] In response to the Nth verification code login request sent by the client, determining a target preset range within a preset range set;
[0018] After determining the target preset range, any character is selected within the target preset range to determine the Nth character verification code, and the Nth character verification code is sent to the client, wherein the Nth character verification code carries the Nth target character identifier.
[0019] In one embodiment, the preset range set includes: az, AZ and 0-9.
[0020] In one embodiment, the method further comprises:
[0021] Receive a first verification code sent by the server, and determine, based on the first verification code, a number of character digits N of the first verification code, a first character of the first verification code, and a first target character identifier of the first character;
[0022] Sending the first target character verification code and the first target character identifier input by the user to the server, so that the server performs a first verification;
[0023] Receiving a first verification success prompt sent by the server, and sending a second verification code login request to the server according to the sequence of characters constituting the first verification code;
[0024] receiving a second character verification code sent by the server, determining a second target character identifier based on the second character verification code, sending the second target character verification code and the second target character identifier input by the user to the server, so that the server performs a second verification, and when it is determined that the second verification is successful, sending a verification code login request corresponding to the next character position to the server, until the Nth verification code login request is sent to the server;
[0025] receiving an Nth character verification code sent by the server, determining an Nth target character identifier based on the Nth character verification code, and sending the Nth target character verification code and the Nth target character identifier input by the user to the server, so that the server performs an Nth verification;
[0026] In response to the Nth verification success prompt sent by the server, the target object is successfully logged in.
[0027] In one embodiment, the method further comprises:
[0028] In response to the verification failure prompt sent by the server, the target character verification code corresponding to the current verification failure prompt is re-entered for verification.
[0029] According to a third aspect of the present disclosure, a verification code generating device is provided, which is applied to a server, and the device includes:
[0030] A first processing module is configured to generate a first verification code having N character digits in response to a first verification code login request sent by a client, and send the first verification code to the client, wherein the first verification code carries a first verification code identifier and a character identifier corresponding to each character constituting the first verification code;
[0031] A first verification module, configured to receive a first target character verification code and a first target character identifier sent by the client, and when it is determined that the first target character verification code is consistent with the first character in the first verification code, verify successfully and send a first verification success prompt to the client, so that the client sends a second verification code login request to the server;
[0032] A second processing module, configured to generate a second character verification code in response to the second verification code login request sent by the client, and send the second character verification code to the client;
[0033] A second verification module is configured to receive a second target character verification code and a second target character identifier sent by the client, and when it is determined that the second target character verification code is consistent with the second character verification code according to the second target character identifier, the verification is successful and a second verification success prompt is sent to the client, so that the client sends a verification code login request corresponding to the next character position to the server, until the client sends an Nth verification code login request to the server;
[0034] A third processing module, configured to generate an N-th character verification code in response to the N-th verification code login request sent by the client, and send the N-th character verification code to the client;
[0035] The third verification module is used to receive the Nth target character verification code and the Nth target character identifier sent by the client, and based on the Nth target character identifier, when it is determined that the Nth target character verification code is consistent with the Nth character verification code, the verification is successful and an Nth verification success prompt is sent to the client, and the Nth verification success prompt enables the client to successfully log in to the target object.
[0036] According to a fourth aspect of the present disclosure, a verification code verification device is provided, which is applied to a client. The device includes:
[0037] A receiving module receives a first verification code sent by a server, and determines, based on the first verification code, a number of character digits N of the first verification code, a first character of the first verification code, and a first target character identifier of the first character;
[0038] A first sending module, used for sending the first target character verification code and the first target character identifier input by the user to the server, so that the server performs a first verification;
[0039] A second sending module is used to receive the first verification success prompt sent by the server, and send a second verification code login request to the server according to the sequence of characters constituting the first verification code;
[0040] a fourth processing module, configured to receive a second character verification code sent by the server, determine a second target character identifier based on the second character verification code, send the second target character verification code input by the user and the second target character identifier to the server, so that the server performs a second verification, and when it is determined that the second verification is successful, send a verification code login request corresponding to the next character position to the server, until an Nth verification code login request is sent to the server;
[0041] A third sending module is used to receive the Nth character verification code sent by the server, determine the Nth target character identifier based on the Nth character verification code, and send the Nth target character verification code input by the user and the Nth target character identifier to the server, so that the server performs an Nth verification;
[0042] The login module is used to successfully log in to the target object in response to the Nth verification success prompt sent by the server.
[0043] According to a fifth aspect of the embodiments of the present disclosure, an electronic device is provided, including:
[0044] one or more processors;
[0045] a storage device for storing one or more programs,
[0046] When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of the first aspect or the second aspect.
[0047] In a sixth aspect, an embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in any one of the first aspect or the second aspect.
[0048] Compared with the prior art, the technical solution provided by the embodiments of the present disclosure has the following advantages:
[0049] The present invention provides a verification code generation method, a verification code verification method, an apparatus, a device and a medium, wherein a first verification code is generated by a server and sent to a client, and verification is performed based on a first target character verification code input by the client and a first character of the first verification code. When the verification is successful, a first verification success prompt is sent to the client, so that the client sends a second verification code login request, so that the server generates a second character verification code at a second character position and sends it to the client. After the client receives the second character verification code, the second target character verification code and the second target character identifier input by the user are sent to the server, and the server verifies the second target character verification code with the second character verification code. Only after each character verification is successful, the server sends a verification success prompt to the client, so that the client sends a second verification code login request. Send a verification code login request for the next character position, so that the server generates a character verification code for the next character position, until the client sends the Nth verification code login request for the last character position, that is, the Nth character position, so that the server generates the Nth character verification code and sends it to the client. After the client obtains the Nth character verification code, it sends the Nth target character verification code and the Nth target character identifier input by the user to the server. The server verifies the Nth target character verification code and the Nth character verification code. When the verification is successful, it sends the Nth verification success prompt to the client, so that the client successfully logs in to the target object, avoiding the problem in the prior art of obtaining verification code information once for verification login, which is easy to be brute-force cracked by hackers to obtain verification code information for automatic login, thereby improving the security of user identity authentication. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0051] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0052] Figure 1 A flowchart of a verification code generation method provided by an embodiment of the present disclosure;
[0053] Figure 2 A flowchart of a verification code verification method provided by an embodiment of the present disclosure;
[0054] Figure 3 A schematic diagram of the structure of a verification code generating device provided in an embodiment of the present disclosure;
[0055] Figure 4A schematic diagram of the structure of a verification code verification device provided by an embodiment of the present disclosure;
[0056] Figure 5 This is a diagram of the internal structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0057] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.
[0058] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.
[0059] The terms "first", "second", etc. in the specification and claims of the present disclosure are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable when appropriate, so that the embodiments of the present disclosure can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally of the same type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0060] With the development of Internet technology and the widespread use of software applications, web pages and systems, in order to ensure the security of users logging into software applications, web pages and systems, verification code technology has been widely used in system login, user identity authentication, etc., verification code (Completely Automated Public Turing test to tell Computers and Humans Apart, CAPTCHA) is the abbreviation of the Turing test to tell Computers and Humans Apart. It is a public fully automatic program to distinguish whether the user is a computer or a human, which can effectively prevent malicious password cracking, ticket swiping, forum flooding and other network security issues.
[0061] In the prior art, users usually verify their identity by obtaining verification code information such as a static image verification code, a character verification code, or a behavior verification code at one time, thereby successfully logging into software applications, web pages, and systems.
[0062] However, with the existing technology, since the user only uses the verification code information obtained once to verify the login, it is easy for hackers to brute force crack the verification code information to achieve automatic login, thereby leaking the user's information and reducing the security of user identity authentication.
[0063] Based on this, the present disclosure provides a verification code generation method, a verification code verification method, an apparatus, a device and a medium, wherein a first verification code is generated by a server and sent to a client, and verification is performed based on a first target character verification code input by the client and a first character of the first verification code. When the verification is successful, a first verification success prompt is sent to the client, so that the client sends a second verification code login request, so that the server generates a second character verification code at a second character position and sends it to the client. After the client receives the second character verification code, it sends the second target character verification code and the second target character identifier input by the user to the server, and the server verifies the second target character verification code with the second character verification code. Only after each character verification is successful, the server sends a verification success prompt to the client, so that the client The client sends a verification code login request for the next character position, so that the server generates a character verification code for the next character position, until the client sends the Nth verification code login request for the last character position, i.e., the Nth character position, so that the server generates the Nth character verification code and sends it to the client. After the client obtains the Nth character verification code, it sends the Nth target character verification code and the Nth target character identifier input by the user to the server. The server verifies the Nth target character verification code and the Nth character verification code. When the verification is successful, it sends the Nth verification success prompt to the client, so that the client successfully logs in to the target object. This avoids the problem in the prior art of obtaining verification code information once for verification login, which is easily cracked by hackers to obtain verification code information for automatic login, thereby improving the security of user identity authentication.
[0064] In one embodiment, Figure 1 As shown, Figure 1 A flowchart of a verification code generation method provided in an embodiment of the present disclosure specifically includes the following steps:
[0065] S11: In response to a first verification code login request sent by the client, generate a first verification code with N characters, and send the first verification code to the client.
[0066] The first verification code carries a first verification code identifier and a character identifier corresponding to each character constituting the first verification code. The first verification code identifier is used to indicate that when the server first receives the first verification code login request sent by the client, the server responds to the first verification code login request and generates a first verification code consisting of multiple characters, i.e., an initial verification code generated by the server. The method of generating the first verification code refers to the prior art and will not be described here. The character identifier is used to determine the corresponding character in the first verification code.
[0067] Exemplarily, when generating a first verification code with 5 characters, such as "a1A09(Q1, Q1-1, Q1-2, Q1-3, Q1-4, Q1-5)", Q1 is the first verification code identifier, indicating that the initial verification code generated by the server for the first time, namely the first verification code, Q1-1, Q1-2, Q1-3, Q1-4, Q1-5 are character identifiers corresponding to each character constituting the first verification code, but not limited to this, the present disclosure does not specifically limit it, and technical personnel in this field can make specific settings according to actual conditions.
[0068] Specifically, when receiving the first verification code login request sent by the client, the server responds to the first verification code login request, generates a first verification code with N characters, and sends the first verification code to the client.
[0069] It should be noted that after generating the first verification code, the server sends the first verification code to the buffer for caching.
[0070] S12: Receive the first target character verification code and the first target character identifier sent by the client. When it is determined that the first target character verification code is consistent with the first character in the first verification code, based on the first target character identifier, the verification is successful and a first verification success prompt is sent to the client, so that the client sends a second verification code login request to the server.
[0071] The first target character identifier is a character identifier corresponding to the first character constituting the first verification code when the server generates the first verification code. Based on the first target character identifier, the server can determine the corresponding first character in the first verification code.
[0072] Specifically, after the client receives the first verification code sent by the server and obtains the first character and the first target character identifier of the first verification code, the user enters the first target character verification code on the client and sends the first target character verification code and the first target character identifier to the server. After receiving the first target character verification code and the first target character identifier sent by the client, the server determines the first character in the first verification code cached in the server cache according to the first target character identifier, compares the first target character verification code with the first character, and when the first target character verification code is consistent with the first character, it indicates that the first verification is successful, and the server sends a first verification success prompt to the client to instruct the client to send a second verification code login request to the server.
[0073] Exemplarily, when the client receives a first verification code such as "a1A09(Q1, Q1-1, Q1-2, Q1-3, Q1-4, Q1-5)" sent by the server, it obtains the first character of the first verification code such as "a" and the first target character identifier "Q1-1". The user enters the first target character verification code such as "a" on the client, and sends the first target character verification code "a" and the first target character identifier to the server "Q1-1". After receiving the first target character verification code "a" and the first target character identifier "Q1-1" sent by the client, the server determines that the first character is "a" in the first verification code cached in the server cache according to the first target character identifier "Q1-1", compares the first target character verification code "a" with the first character "a", and when the first target character verification code is consistent with the first character, it indicates that the first verification is successful, and the server sends a first verification success prompt to the client to instruct the client to send a second verification code login request to the server.
[0074] S13: In response to the second verification code login request sent by the client, generate a second character verification code, and send the second character verification code to the client.
[0075] Among them, the second verification code login request is used to obtain the second character verification code corresponding to the second character position in the first verification code, and the second character verification code is used to replace the initial second character corresponding to the second character position of the first verification code received by the client, and the second character verification code carries a second target character identifier. Exemplarily, the second character verification code can be "3(Q2-2)", but is not limited to this. The present disclosure does not specifically limit it, and technical personnel in this field can make specific settings according to actual conditions.
[0076] Specifically, the client receives and responds to the first verification success prompt sent by the server. After determining that the first verification is successful, the client sends a second verification code login request to the server. The server responds to the second verification code login request, generates a second character verification code, and sends the second character verification code to the client.
[0077] It should be noted that after generating the second character verification code, the server sends the second character verification code to the buffer for caching.
[0078] Optionally, based on the above embodiments, in some embodiments of the present disclosure, an implementation of S13 may be:
[0079] Step A-1: In response to a second verification code login request sent by the client, a target preset range is determined within a preset range set.
[0080] The preset range set includes: az, AZ and 0-9, but is not limited thereto. The present disclosure does not specifically limit this, and those skilled in the art may make specific settings according to actual conditions.
[0081] Step A-2: After determining the target preset range, select any character within the target preset range to determine a second character verification code.
[0082] Among them, the second character verification code carries a second target character identifier. Exemplarily, continuing the above embodiment, for the second character verification code "3(Q2-2)", the second target character identifier is "Q2-2", but not limited to this. The present disclosure does not specifically limit it, and those skilled in the art can make specific settings according to actual conditions.
[0083] Specifically, in response to the second verification code login request sent by the client, the server determines a target preset range from multiple preset ranges, and after determining the target preset range, selects a character from the target preset range as the second character verification code.
[0084] Exemplarily, a target preset range of 0-9 can be determined by calling a random function among multiple preset ranges such as az, AZ and 0-9. After the target preset range is determined to be 0-9, a character such as "3" is determined in 0-9 by calling a random function to obtain the second character verification code "3(Q2-2)", but is not limited to this. The present disclosure does not specifically limit it, and those skilled in the art can make specific settings according to actual conditions.
[0085] S14: Receive the second target character verification code and the second target character identifier sent by the client. Based on the second target character identifier, when it is determined that the second target character verification code is consistent with the second character verification code, the verification is successful and a second verification success prompt is sent to the client, so that the client sends a verification code login request corresponding to the next character position to the server, until the client sends the Nth verification code login request to the server.
[0086] The second target character verification code is a character verification code input by the client after obtaining the second character verification code.
[0087] Specifically, after the client receives the second character verification code sent by the server, it obtains the second target character identifier corresponding to the second character verification code. The user enters the second target character verification code on the client and sends the second target character verification code and the second target character identifier to the server. After receiving the second target character verification code and the second target character identifier sent by the client, the server determines the second character verification code in the server cache according to the second target character identifier, compares the second target character verification code with the second character verification code, and when they are consistent, it indicates that the second verification is successful. The server sends a second verification success prompt to the client to instruct the client to send the verification code login request corresponding to the next character position, that is, the third verification code login request, to the server. After each successful verification, the server will send a verification success prompt to the client until the client sends the Nth verification code login request to the server.
[0088] Exemplarily, after the client receives the second character verification code "3(Q2-2)" sent by the server, it obtains the second target character identifier "Q2-2" corresponding to the second character verification code. The user enters the second target character verification code such as "3" on the client, and sends the second target character verification code "3" and the second target character identifier "Q2-2" to the server. After receiving the second target character verification code "3" and the second target character identifier "Q2-2" sent by the client, the server determines that the second character verification code is "3" in the server cache according to the second target character identifier "Q2-2", compares the second target character verification code "3" with the character "3" in the second character verification code. When they are consistent, it indicates that the second verification is successful. The server sends a second verification success prompt to the client to instruct the client to send the verification code login request corresponding to the next character position, that is, the third verification code login request, to the server. After each successful verification, the server will send a verification success prompt to the client until the client sends the Nth verification code login request to the server.
[0089] S15: In response to the Nth verification code login request sent by the client, generate an Nth character verification code, and send the Nth character verification code to the client.
[0090] Among them, the Nth verification code login request is used to obtain the Nth character verification code corresponding to the Nth character position in the first verification code, and the Nth character verification code is used to replace the initial Nth character corresponding to the Nth character position of the first verification code received by the client, and the Nth character verification code carries the Nth target character identifier.
[0091] Exemplarily, for the first verification code "a1A09(Q1, Q1-l, Q1-2, Q1-3, Q1-4, Q1-5)", it can be determined that N is 5, then the fifth character verification code can be "7(Q2-5)", and the fifth target character identifier is "Q2-5", but is not limited to this. The present disclosure does not specifically limit it, and technical personnel in this field can make specific settings according to actual conditions.
[0092] Specifically, the client receives and responds to the N-1th verification success prompt sent by the server. After determining that the N-1th verification is successful, the client sends the Nth verification code login request to the server. The server responds to the Nth verification code login request, generates the Nth character verification code, and sends the Nth character verification code to the client.
[0093] It should be noted that after the server generates the N-th character verification code, it sends the N-th character verification code to the buffer for caching.
[0094] Optionally, based on the above embodiments, in some embodiments of the present disclosure, an implementation of S15 may be:
[0095] Step B-1: In response to the Nth verification code login request sent by the client, a target preset range is determined within a preset range set.
[0096] Step B-2: After determining the target preset range, select any character within the target preset range to determine the Nth character verification code.
[0097] The Nth character verification code carries the Nth target character identifier. Exemplarily, following the above embodiment, for the Nth character verification code "7(Q2-N)", the Nth target character identifier is "Q2-N", but not limited thereto, and the present disclosure does not specifically limit it, and those skilled in the art can set it specifically according to actual conditions.
[0098] Specifically, the server determines a target preset range from multiple preset ranges in response to the Nth verification code login request sent by the client, and after determining the target preset range, selects a character from the target preset range as the Nth character verification code.
[0099] S16: Receive the Nth target character verification code and the Nth target character identifier sent by the client, and when it is determined that the Nth target character verification code is consistent with the Nth character verification code according to the Nth target character identifier, verify successfully and send an Nth verification success prompt to the client.
[0100] The Nth verification success prompt enables the client to successfully log in to the target object. The Nth target character verification code is the character verification code input by the client user after obtaining the Nth character verification code.
[0101] Specifically, after the client receives the Nth character verification code sent by the server, it obtains the Nth target character identifier corresponding to the Nth character verification code. The user enters the Nth target character verification code on the client and sends the Nth target character verification code and the Nth target character identifier to the server. After receiving the Nth target character verification code and the Nth target character identifier sent by the client, the server determines the Nth character verification code in the server cache according to the Nth target character identifier, compares the Nth target character verification code with the Nth character verification code, and when they are consistent, it indicates that the Nth verification is successful. The server sends the Nth verification success prompt to the client to indicate that the client has successfully logged in to the target object.
[0102] Exemplarily, following the above embodiment, the first verification code is "a1A09(Q1, Q1-1, Q1-2, Q1-3, Q1-4, Q1-5)", N is determined to be 5, and the fifth character verification code corresponding to the fifth character position is determined to be "7(Q2-5)". After the client receives the fifth character verification code "7(Q2-5)" sent by the server, the fifth character "9(Q1-5)" corresponding to the fifth character position in the first verification code is replaced by the fifth character verification code "7(Q2-5)", and the fifth target character identifier "Q2-5" corresponding to the fifth character verification code is obtained. The user enters the fifth target character on the client. The fifth target character verification code is such as "7", and the fifth target character verification code "7" and the fifth target character identifier "Q2-5" are sent to the server. After receiving the fifth target character verification code "7" and the fifth target character identifier "Q2-5" sent by the client, the server determines that the fifth character verification code is "7(Q2-5)" in the server cache according to the fifth target character identifier "Q2-5", and compares the fifth target character verification code "7" with the character "7" in the fifth character verification code. When they are consistent, it indicates that the fifth verification is successful. The server sends a fifth verification success prompt to the client to indicate that the client has successfully logged in to the target object.
[0103] In this way, in this embodiment, the server generates a first verification code and sends it to the client, and verifies the first target character verification code input by the client and the first character of the first verification code. When the verification is successful, a first verification success prompt is sent to the client, so that the client sends a second verification code login request, so that the server generates a second character verification code at the second character position and sends it to the client. After the client receives the second character verification code, it sends the second target character verification code and the second target character identifier input by the user to the server, and the server verifies the second target character verification code with the second character verification code. Only after each character verification is successful, the server sends a verification success prompt to the client, so that the client sends the verification code at the next character position to log in The N-th character verification code is generated by the client and sent to the client after the client obtains the N-th character verification code. The N-th target character verification code and the N-th target character identifier input by the user are sent to the server. The server verifies the N-th target character verification code and the N-th character verification code. When the verification is successful, the N-th verification success prompt is sent to the client, so that the client successfully logs in to the target object. This avoids the problem in the prior art of obtaining verification code information once for verification and login, which is easily cracked by hackers to obtain verification code information for automatic login, thereby improving the security of user identity authentication.
[0104] Optionally, based on the above embodiments, in some embodiments of the present disclosure, when it is determined that verification according to any target character verification code fails, a verification failure prompt is sent to the client.
[0105] Specifically, when the server performs verification according to any target character verification code received from the client and the verification fails, the server sends a verification failure prompt to the client to instruct the client to re-enter the target character verification code for verification.
[0106] In this way, in this embodiment, when the server receives any target character verification code sent by the client for verification and the verification fails, it can send a verification failure prompt to the client to promptly remind the user to re-enter the target character verification code for verification.
[0107] In one embodiment, Figure 2 As shown, Figure 2 A flowchart of a verification code verification method provided in an embodiment of the present disclosure specifically includes the following steps:
[0108] S21: Receive a first verification code sent by the server, and determine, based on the first verification code, a character number N of the first verification code, a first character of the first verification code, and a first target character identifier of the first character.
[0109] S22: Sending the first target character verification code and the first target character identifier input by the user to the server, so that the server performs a first verification.
[0110] S23: Receive the first verification success prompt sent by the server, and send a second verification code login request to the server according to the sequence of characters constituting the first verification code.
[0111] S24: Receive the second character verification code sent by the server, determine the second target character identifier based on the second character verification code, send the second target character verification code and the second target character identifier input by the user to the server, so that the server performs a second verification, and when it is determined that the second verification is successful, send a verification code login request corresponding to the next character position to the server, until the Nth verification code login request is sent to the server.
[0112] S25: Receive the Nth character verification code sent by the server, determine the Nth target character identifier based on the Nth character verification code, and send the Nth target character verification code and the Nth target character identifier input by the user to the server, so that the server performs the Nth verification.
[0113] S26: In response to the Nth verification success prompt sent by the server, the target object is successfully logged in.
[0114] Specifically, when the user enters the first verification code login request, the client sends the first verification code login request to the server. The server receives and responds to the first verification code login request sent by the client, and generates a first verification code carrying a first verification code identifier and a character identifier corresponding to each character constituting the first verification code, with a character number of N. After receiving the first verification code, the client determines that the number of character numbers of the first verification code is N, the first character, and the first target character identifier of the first character, and sends the first target character verification code and the first target character identifier entered by the user to the server. The server performs verification based on the first target character verification code entered by the client and the first character of the first verification code. When the verification is successful, the server sends a first verification success prompt to the client. After receiving the first verification success prompt, the client sends a second verification code login request, so that the server generates a character identifier carrying the second target character at the second character position. The second character verification code of the identifier is sent to the client. After the client receives the second character verification code, it sends the second target character verification code and the second target character identifier input by the user to the server. The server verifies the second target character verification code with the second character verification code. After the verification is successful, the server sends a second verification success prompt to the client, so that the client sends a verification code login request corresponding to the next character position, until the last character position, i.e., the Nth verification code login request, is sent to the server, so that the server generates the Nth character verification code and sends it to the client. After the client obtains the Nth character verification code, it sends the Nth target character verification code and the Nth target character identifier input by the user to the server. The server will receive the Nth target character verification code and the Nth character verification code for verification. When the verification is successful, it sends the Nth verification success prompt to the client. The client responds to the Nth verification success prompt and successfully logs in to the target object.
[0115] In this way, in this embodiment, the server generates a first verification code and sends it to the client, and verifies the first target character verification code input by the client and the first character of the first verification code. When the verification is successful, a first verification success prompt is sent to the client, so that the client sends a second verification code login request, so that the server generates a second character verification code at the second character position and sends it to the client. After the client receives the second character verification code, it sends the second target character verification code and the second target character identifier input by the user to the server, and the server verifies the second target character verification code with the second character verification code. Only after each character verification is successful, the server sends a verification success prompt to the client, so that the client sends the verification code at the next character position to log in The N-th character verification code is generated by the client and sent to the client after the client obtains the N-th character verification code. The N-th target character verification code and the N-th target character identifier input by the user are sent to the server. The server verifies the N-th target character verification code and the N-th character verification code. When the verification is successful, the N-th verification success prompt is sent to the client, so that the client successfully logs in to the target object. This avoids the problem in the prior art of obtaining verification code information once for verification and login, which is easily cracked by hackers to obtain verification code information for automatic login, thereby improving the security of user identity authentication.
[0116] Optionally, based on the above embodiments, in some embodiments of the present disclosure, the following further includes:
[0117] In response to the verification failure prompt sent by the server, re-enter the target character verification code corresponding to the current verification failure prompt for verification.
[0118] Specifically, after receiving the verification failure prompt, the user re-enters the target character verification code corresponding to the current verification failure prompt and sends it to the server so that the server re-verifies.
[0119] In this way, this embodiment can timely re-enter the target character verification code for verification when receiving the verification failure prompt sent by the server.
[0120] The disclosed embodiment also provides a verification code generation device, which is used to execute any one of the verification code generation methods provided in the above embodiments, and has the corresponding beneficial effects of the verification code generation method.
[0121] Figure 3 A verification code generation device provided in an embodiment of the present disclosure is applied to a server, including:
[0122] The first processing module 11 is used to generate a first verification code with N character digits in response to the first verification code login request sent by the client, and send the first verification code to the client, wherein the first verification code carries a first verification code identifier and a character identifier corresponding to each character constituting the first verification code;
[0123] The first verification module 12 is used to receive the first target character verification code and the first target character identifier sent by the client. According to the first target character identifier, when it is determined that the first target character verification code is consistent with the first character in the first verification code, the verification is successful and a first verification success prompt is sent to the client, so that the client sends a second verification code login request to the server.
[0124] The second processing module 13 is used to generate a second character verification code in response to a second verification code login request sent by the client, and send the second character verification code to the client.
[0125] The second verification module 14 is used to receive the second target character verification code and the second target character identifier sent by the client. According to the second target character identifier, when it is determined that the second target character verification code is consistent with the second character verification code, the verification is successful and a second verification success prompt is sent to the client, so that the client sends a verification code login request corresponding to the next character position to the server, until the client sends the Nth verification code login request to the server.
[0126] The third processing module 15 is configured to generate an N-th character verification code in response to the N-th verification code login request sent by the client, and send the N-th character verification code to the client.
[0127] The third verification module 16 is used to receive the Nth target character verification code and the Nth target character identifier sent by the client, and based on the Nth target character identifier, when it is determined that the Nth target character verification code is consistent with the Nth character verification code, the verification is successful and the Nth verification success prompt is sent to the client, and the Nth verification success prompt enables the client to successfully log in to the target object.
[0128] In the above embodiment, the second processing module 13 is specifically used to respond to the second verification code login request sent by the client, determine the target preset range within the preset range set; after determining the target preset range, select any character within the target preset range to determine the second character verification code, and send the second character verification code to the client, wherein the second character verification code carries the second target character identifier.
[0129] The third processing module 15 is specifically configured to respond to the Nth verification code login request sent by the client, determine a target preset range within the preset range set, select any character within the target preset range to determine the Nth character verification code, and send the Nth character verification code to the client, wherein the Nth character verification code carries the Nth target character identifier.
[0130] In the above embodiment, the preset range set includes: az, AZ, and 0-9.
[0131] In the above embodiment, the device further comprises: a verification failure prompt module, which is used to send a verification failure prompt to the client when it is determined that the verification according to any target character verification code fails.
[0132] In this way, in this embodiment, the first processing module 11 is used to respond to the first verification code login request sent by the client, generate a first verification code with N character digits, and send the first verification code to the client, wherein the first verification code carries the first verification code identifier and the character identifier corresponding to each character constituting the first verification code; the first verification module 12 is used to receive the first target character verification code and the first target character identifier sent by the client, and according to the first target character identifier, when it is determined that the first target character verification code is consistent with the first character in the first verification code, the verification is successful and the first verification success prompt is sent to the client, so that the client sends a second verification code login request to the server. The second processing module 13 is used to respond to the second verification code login request sent by the client, generate a second character verification code, and send the second character verification code to the client. The second verification module 14 is used to receive the second target character verification code and the second target character identifier sent by the client, and according to the second target character identifier, when it is determined that the second target character verification code is consistent with the second character verification code, the verification is successful and the second verification success prompt is sent to the client, so that the client sends the verification code login request corresponding to the next character position to the server, until the client sends the Nth verification code login request to the server. The third processing module 15 is used to respond to the Nth verification code login request sent by the client, generate the Nth character verification code, and send the Nth character verification code to the client. The third verification module 16 is used to receive the Nth target character verification code and the Nth target character identifier sent by the client, and according to the Nth target character identifier, when it is determined that the Nth target character verification code is consistent with the Nth character verification code, the verification is successful and the Nth verification success prompt is sent to the client. The Nth verification success prompt enables the client to successfully log in to the target object, avoiding the problem in the prior art that the verification login is performed by obtaining the verification code information once, which is easy to be cracked by hackers to obtain the verification code information to achieve automatic login, thereby improving the security of user identity authentication.
[0133] The disclosed embodiment also provides a verification code verification device, which is used to execute any of the verification code verification methods provided in the above embodiments, and has the corresponding beneficial effects of the verification code verification method.
[0134] Figure 4 A verification code verification device provided in an embodiment of the present disclosure is applied to a client, including:
[0135] The receiving module 21 is used to receive a first verification code sent by the server, and based on the first verification code, determine the number of character digits of the first verification code as N, the first character of the first verification code, and the first target character identifier of the first character.
[0136] The first sending module 22 is used to send the first target character verification code and the first target character identifier input by the user to the server, so that the server performs a first verification.
[0137] The second sending module 23 is used to receive the first verification success prompt sent by the server, and send a second verification code login request to the server according to the sequence of characters constituting the first verification code.
[0138] The fourth processing module 24 is used to receive the second character verification code sent by the server, determine the second target character identifier based on the second character verification code, and send the second target character verification code and the second target character identifier input by the user to the server, so that the server can perform a second verification, and when it is determined that the second verification is successful, send a verification code login request corresponding to the next character position to the server, until the Nth verification code login request is sent to the server.
[0139] The third sending module 25 is used to receive the Nth character verification code sent by the server, determine the Nth target character identifier based on the Nth character verification code, and send the Nth target character verification code and the Nth target character identifier input by the user to the server, so that the server performs the Nth verification.
[0140] The login module 26 is used to successfully log in to the target object in response to the Nth verification success prompt sent by the server.
[0141] In the above embodiment, the device further includes: a re-verification module, which is used to respond to the verification failure prompt sent by the server and re-enter the target character verification code corresponding to the current verification failure prompt for verification.
[0142] In this way, the present embodiment uses a receiving module 21 to receive the first verification code sent by the server, and based on the first verification code, determines that the number of character digits of the first verification code is N, the first character of the first verification code, and the first target character identifier of the first character. The first sending module 22 is used to send the first target character verification code and the first target character identifier input by the user to the server, so that the server performs the first verification. The second sending module 23 is used to receive the first verification success prompt sent by the server, and send a second verification code login request to the server according to the sequence of characters constituting the first verification code. The fourth processing module 24 is used to receive the second character verification code sent by the server, determine the second target character identifier based on the second character verification code, send the second target character verification code and the second target character identifier input by the user to the server, so that the server performs the second verification, and when it is determined that the second verification is successful, send the verification code login request corresponding to the next character position to the server, until the Nth verification code login request is sent to the server. The third sending module 25 is used to receive the Nth character verification code sent by the server, determine the Nth target character identifier based on the Nth character verification code, and send the Nth target character verification code and the Nth target character identifier input by the user to the server, so that the server performs the Nth verification. The login module 26 is used to respond to the Nth verification success prompt sent by the server, successfully log in to the target object, avoid the problem in the prior art that the verification login is performed by obtaining the verification code information once, which is easy to be violently cracked by hackers to obtain the verification code information to achieve automatic login, and improve the security of user identity authentication.
[0143] Figure 5 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure, such as Figure 5 As shown, the electronic device includes a processor 510, a memory 520, an input device 530 and an output device 540; the number of processors 510 in the computer device can be one or more. Figure 5 A processor 510 is taken as an example; the processor 510, the memory 520, the input device 530 and the output device 540 in the electronic device can be connected via a bus or other means. Figure 5 The example of connecting through bus is taken in the following.
[0144] The memory 520 is a computer-readable storage medium that can be used to store software programs, computer executable programs and modules, such as program instructions / modules corresponding to the method in the embodiment of the present invention. The processor 510 executes various functional applications and data processing of the computer device by running the software programs, instructions and modules stored in the memory 520, that is, implements the method provided in the embodiment of the present invention.
[0145] The memory 520 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and at least one application required for a function; the data storage area may store data created according to the use of the terminal, etc. In addition, the memory 520 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 520 may further include a memory remotely arranged relative to the processor 510, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0146] The input device 530 may be used to receive input digital or character information and generate key signal input related to user settings and function control of the electronic device, and may include a keyboard, a mouse, etc. The output device 540 may include a display device such as a display screen.
[0147] The embodiments of the present disclosure also provide a storage medium including computer executable instructions, which, when executed by a computer processor, are used to implement the verification code generation method or verification code verification method provided by the embodiments of the present disclosure.
[0148] Of course, the computer executable instructions of a storage medium including computer executable instructions provided by an embodiment of the present invention are not limited to the operations of the method described above, but can also execute related operations in the method provided by any embodiment of the present invention.
[0149] Through the above description of the implementation methods, the technicians in the relevant field can clearly understand that the present invention can be implemented by means of software and necessary general hardware, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, a read-only memory (ROM), a random access memory (RAM), a flash memory (FLASH), a hard disk or an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0150] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0151] The above description is only a specific embodiment of the present disclosure, so that those skilled in the art can understand or implement the present disclosure. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A verification code generation method, characterized in that: Applied to the server, the method includes: In response to a first verification code login request sent by a client, generate a first verification code with N character digits, and send the first verification code to the client, wherein the first verification code carries a first verification code identifier and a character identifier corresponding to each character constituting the first verification code; receiving a first target character verification code and a first target character identifier sent by the client, and when it is determined, based on the first target character identifier, that the first target character verification code is consistent with the first character in the first verification code, verifying success and sending a first verification success prompt to the client, so that the client sends a second verification code login request to the server; In response to the second verification code login request sent by the client, generate a second character verification code, and send the second character verification code to the client; receiving a second target character verification code and a second target character identifier sent by the client, and when it is determined that the second target character verification code is consistent with the second character verification code according to the second target character identifier, verifying success and sending a second verification success prompt to the client, so that the client sends a verification code login request corresponding to the next character position to the server, until the client sends the Nth verification code login request to the server; In response to the Nth verification code login request sent by the client, generate an Nth character verification code, and send the Nth character verification code to the client; receiving an Nth target character verification code and an Nth target character identifier sent by the client, and when it is determined that the Nth target character verification code is consistent with the Nth character verification code according to the Nth target character identifier, verifying successfully and sending an Nth verification success prompt to the client, wherein the Nth verification success prompt enables the client to successfully log in to the target object; The step of generating a second character verification code in response to the second verification code login request sent by the client, and sending the second character verification code to the client includes: In response to the second verification code login request sent by the client, determining a target preset range within a preset range set; After determining the target preset range, selecting any character within the target preset range to determine the second character verification code, and sending the second character verification code to the client, wherein the second character verification code carries a second target character identifier; or The step of generating an N-character verification code in response to the N-th verification code login request sent by the client, and sending the N-character verification code to the client includes: In response to the Nth verification code login request sent by the client, determining a target preset range within a preset range set; After determining the target preset range, any character is selected within the target preset range to determine the Nth character verification code, and the Nth character verification code is sent to the client, wherein the Nth character verification code carries the Nth target character identifier.
2. The method according to claim 1, characterized in that The preset range set includes: az, AZ and 0-9.
3. The method according to claim 1, characterized in that: The method further comprises: When it is determined that verification according to any target character verification code fails, a verification failure prompt is sent to the client.
4. A verification code verification method, characterized in that: Applied to a client, the method comprises: receiving a first verification code sent by a server, and determining, based on the first verification code, a number of character digits of the first verification code, which is N, a first character of the first verification code, and a first target character identifier of the first character; the server executing the verification code generation method according to claim 1; Sending the first target character verification code and the first target character identifier input by the user to the server, so that the server performs a first verification; Receiving a first verification success prompt sent by the server, and sending a second verification code login request to the server according to the sequence of characters constituting the first verification code; receiving a second character verification code sent by the server, determining a second target character identifier based on the second character verification code, sending the second target character verification code input by the user and the second target character identifier to the server, so that the server performs a second verification, and when determining that the second verification is successful, sending a verification code login request corresponding to the next character position to the server, until sending the Nth verification code login request to the server; receiving an Nth character verification code sent by the server, determining an Nth target character identifier based on the Nth character verification code, and sending the Nth target character verification code and the Nth target character identifier input by the user to the server, so that the server performs an Nth verification; In response to the Nth verification success prompt sent by the server, the target object is successfully logged in.
5. The method according to claim 4, characterized in that The method further comprises: In response to the verification failure prompt sent by the server, the target character verification code corresponding to the current verification failure prompt is re-entered for verification.
6. A verification code generating device, characterized in that: Applied to the server, the device comprises: A first processing module is configured to generate a first verification code having N character digits in response to a first verification code login request sent by a client, and send the first verification code to the client, wherein the first verification code carries a first verification code identifier and a character identifier corresponding to each character constituting the first verification code; A first verification module, configured to receive a first target character verification code and a first target character identifier sent by the client, and when it is determined that the first target character verification code is consistent with the first character in the first verification code, verify successfully and send a first verification success prompt to the client, so that the client sends a second verification code login request to the server; A second processing module, configured to generate a second character verification code in response to the second verification code login request sent by the client, and send the second character verification code to the client; A second verification module is configured to receive a second target character verification code and a second target character identifier sent by the client, and when it is determined that the second target character verification code is consistent with the second character verification code according to the second target character identifier, the verification is successful and a second verification success prompt is sent to the client, so that the client sends a verification code login request corresponding to the next character position to the server, until the client sends an Nth verification code login request to the server; A third processing module, configured to generate an N-th character verification code in response to the N-th verification code login request sent by the client, and send the N-th character verification code to the client; A third verification module is configured to receive an Nth target character verification code and an Nth target character identifier sent by the client, and when it is determined that the Nth target character verification code is consistent with the Nth character verification code according to the Nth target character identifier, verify successfully and send an Nth verification success prompt to the client, wherein the Nth verification success prompt enables the client to successfully log in to the target object; The second processing module is specifically configured to respond to the second verification code login request sent by the client, determine a target preset range within a preset range set; after determining the target preset range, select any character within the target preset range to determine the second character verification code, and send the second character verification code to the client, wherein the second character verification code carries a second target character identifier; The third processing module is specifically used to respond to the Nth verification code login request sent by the client, determine a target preset range within a preset range set; after determining the target preset range, select any character within the target preset range to determine the Nth character verification code, and send the Nth character verification code to the client, wherein the Nth character verification code carries the Nth target character identifier.
7. A verification code verification device, characterized in that: Applied to a client, the device comprises: A receiving module receives a first verification code sent by a server, and determines, based on the first verification code, a number of character digits of the first verification code, which is N, a first character of the first verification code, and a first target character identifier of the first character; the server executes the verification code generation method according to claim 1; A first sending module, used for sending the first target character verification code and the first target character identifier input by the user to the server, so that the server performs a first verification; A second sending module is used to receive the first verification success prompt sent by the server, and send a second verification code login request to the server according to the sequence of characters constituting the first verification code; a fourth processing module, configured to receive a second character verification code sent by the server, determine a second target character identifier based on the second character verification code, send the second target character verification code input by the user and the second target character identifier to the server, so that the server performs a second verification, and when it is determined that the second verification is successful, send a verification code login request corresponding to the next character position to the server, until an Nth verification code login request is sent to the server; A third sending module is used to receive the Nth character verification code sent by the server, determine the Nth target character identifier based on the Nth character verification code, and send the Nth target character verification code input by the user and the Nth target character identifier to the server, so that the server performs an Nth verification; The login module is used to successfully log in to the target object in response to the Nth verification success prompt sent by the server.
8. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the steps of the verification code generation method according to any one of claims 1 to 3 or the steps of the verification code verification method according to any one of claims 4 to 5.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the verification code generation method according to any one of claims 1 to 3 or the steps of the verification code verification method according to any one of claims 4 to 5 are implemented.
