CN110730152B - Login verification method and device and electronic equipment - Google Patents

Login verification method and device and electronic equipment Download PDF

Info

Publication number
CN110730152B
CN110730152B CN201810778164.5A CN201810778164A CN110730152B CN 110730152 B CN110730152 B CN 110730152B CN 201810778164 A CN201810778164 A CN 201810778164A CN 110730152 B CN110730152 B CN 110730152B
Authority
CN
China
Prior art keywords
dimensional code
code image
user
current
verified
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810778164.5A
Other languages
Chinese (zh)
Other versions
CN110730152A (en
Inventor
李云廷
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Hikvision Digital Technology Co Ltd
Original Assignee
Hangzhou Hikvision Digital Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Hikvision Digital Technology Co Ltd filed Critical Hangzhou Hikvision Digital Technology Co Ltd
Priority to CN201810778164.5A priority Critical patent/CN110730152B/en
Publication of CN110730152A publication Critical patent/CN110730152A/en
Application granted granted Critical
Publication of CN110730152B publication Critical patent/CN110730152B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • H04L63/0815Network architectures or network communication protocols for network security for authentication of entities providing single-sign-on or federations
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/14Network architectures or network communication protocols for network security for detecting or protecting against malicious traffic
    • H04L63/1408Network architectures or network communication protocols for network security for detecting or protecting against malicious traffic by monitoring network traffic
    • H04L63/1416Event detection, e.g. attack signature detection
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/14Network architectures or network communication protocols for network security for detecting or protecting against malicious traffic
    • H04L63/1441Countermeasures against malicious traffic

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The embodiment of the invention provides a login verification method, a login verification device and electronic equipment, wherein the method comprises the following steps: after receiving a login verification instruction of a user to be verified, obtaining a current verification code image; the method comprises the steps of obtaining the current accumulated click times of a user to be verified, and decoding a current verification code image according to the click position of the user to be verified on the current verification code image when the current accumulated click times does not exceed a set click times threshold value to obtain the decoding result of the current verification code image; and when the decoding result is failure and the next login verification instruction of the user to be verified is received, and the obtained accumulated click times of the user to be verified exceed the set click times threshold, determining that the user to be verified is an illegal user. The method and the device have the advantages that the verification accuracy of the problems of automatic login, malicious multiple login and the like is improved, and the defense of the automatic login and the malicious multiple login is enhanced.

Description

Login verification method and device and electronic equipment
Technical Field
The present invention relates to the field of information security technologies, and in particular, to a login authentication method and apparatus, and an electronic device.
Background
In the current computer application, the website login verification code is set to solve the problems of automatic login, malicious multiple login and the like, which can increase the burden of a website server and further influence the use of normal users. This is undesirable for both website owners and regular users.
In order to solve the problems of automatic login, malicious multiple login and the like, in the related technology, when a login instruction sent by a user is received, M verification code pictures are obtained, the M verification code pictures are generated into M two-dimensional code pictures, one two-dimensional code picture is determined from the M two-dimensional code pictures to be a verification two-dimensional code, and other two-dimensional code pictures except the verification two-dimensional code picture in the M two-dimensional code pictures are subjected to re-coloring treatment so as to guide and authorize the user to scan and identify the truly effective verification two-dimensional code through different colors to pass login verification.
However, in the related art, the verification two-dimensional code can still be recognized based on color detection through an automatic detection recognition technology, so that automatic login is realized. Therefore, the related technology still has potential safety hazards, and the accuracy of verification on the problems of automatic login, malicious multiple login and the like is not high enough.
Disclosure of Invention
Embodiments of the present invention provide a login authentication method, device and electronic device, so as to improve the accuracy of authentication for problems such as automatic login and malicious multiple login, and enhance the defense for automatic login and malicious multiple login. The specific technical scheme is as follows:
in one aspect, an embodiment of the present invention provides a login verification method, where the method includes:
receiving a login verification instruction of a user to be verified;
obtaining a current verification code image according to the login verification instruction, wherein the verification code image comprises a two-dimensional code image which is pre-divided into N two-dimensional code blocks, M two-dimensional code blocks in the N two-dimensional code blocks are covered or replaced by preset non-two-dimensional code images, N and M are positive integers, and M is smaller than or equal to N;
obtaining the current accumulated click times of the user to be verified, and decoding the current verification code image according to the click position of the user to be verified on the current verification code image when the current accumulated click times does not exceed a set click times threshold value to obtain the decoding result of the current verification code image;
and when the decoding result is failure and the next login verification instruction of the user to be verified is received, and the obtained accumulated click times of the user to be verified exceed the set click times threshold value, determining that the user to be verified is an illegal user.
Optionally, the method further comprises:
when the current accumulated click times exceed the set click times threshold, determining that the user to be verified is an illegal user; or
And when the decoding result is successful, determining that the user to be verified is a legal user.
Optionally, the step of obtaining the current accumulated number of clicks of the user to be verified includes:
according to the login verification instruction, increasing the stored accumulated click times by 1, wherein the stored accumulated click times are as follows: receiving the accumulated click times determined when the previous login verification instruction of the user to be verified is received;
taking the accumulated click times after 1 increment as the current accumulated click times of the user to be verified; or the like, or, alternatively,
obtaining the stored accumulated click times as the current accumulated click times of the user to be verified;
after the step of obtaining the stored cumulative clicks as the current cumulative clicks of the user to be authenticated, the method further includes:
when the decoding result is failure, increasing the current accumulated click times by 1;
and taking the accumulated click times after 1 increment as the accumulated click times of the user to be verified, which is obtained when the next login verification instruction of the user to be verified is received.
Optionally, after the step of obtaining the stored cumulative clicks as the current cumulative clicks of the user to be verified, the method further includes:
and when the current accumulated click times do not exceed the set click times threshold and the two-dimensional code block corresponding to the click position is determined to be a two-dimensional code block according to the click position, incrementing the current accumulated click times by 1.
Optionally, the step of decoding the current verification code image according to the click position of the user to be verified on the current verification code image includes:
and according to the click position, when the two-dimensional code block corresponding to the click position in the current verification code image is determined to be a non-two-dimensional code image or covered by the non-two-dimensional code image, restoring the two-dimensional code block covered or replaced by the non-two-dimensional code image, and decoding the verification code image after restoration processing.
Optionally, after the step of performing recovery processing on the two-dimensional code block covered or replaced by the non-two-dimensional code image, the method further includes:
and replacing the current verification code image with the verification code image obtained after recovery processing to serve as the current verification code image when the next login verification instruction of the user to be verified is received.
Optionally, before the step of receiving a login authentication instruction of a user to be authenticated, the method further includes:
obtaining a two-dimensional code image to be processed;
segmenting the two-dimensional code image to be processed to obtain N two-dimensional code blocks;
randomly selecting M two-dimensional code blocks from the N two-dimensional code blocks;
for the selected M two-dimensional code blocks, covering or replacing the M two-dimensional code blocks with P non-two-dimensional code images to generate the verification code image, wherein P is a positive integer not greater than M;
the step of receiving the login authentication instruction of the user to be authenticated comprises the following steps:
and receiving a login verification instruction sent by a user to be verified aiming at the verification code image.
Optionally, the step of generating the verification code image by covering or replacing the M two-dimensional code blocks with P non-two-dimensional code images for the selected M two-dimensional code blocks includes:
judging whether the current filling operation frequency exceeds Z; wherein Z is equal to M minus 1;
when the current filling operation frequency does not exceed Z, covering or replacing one uncovered or replaced two-dimensional code block in the M two-dimensional code blocks by using one non-two-dimensional code image in the P non-two-dimensional code images to obtain a current two-dimensional code image to be processed;
the filling operation times are increased by 1 as the current filling operation times, and the step of judging whether the current filling operation times exceed the Z is returned;
and when the current filling operation frequency is judged to exceed Z, determining the current two-dimensional code image to be processed as the verification code image.
Optionally, before the step of incrementing the number of filling operations by 1 as the current number of filling operations, the method further includes:
decoding the current two-dimensional code image to be processed;
when the decoding of the current two-dimensional code image to be processed fails, executing the step of increasing the filling operation times by 1 as the current filling operation times;
when the current to-be-processed two-dimensional code image is successfully decoded, the decoding redundancy times are increased by 1, and the filling operation times are increased by 1 as the current filling operation times, wherein the decoding redundancy times are used for setting the set click time threshold.
Optionally, after the step of determining the current two-dimensional code image to be processed as the verification code image, the method further includes:
obtaining the decoding redundancy times when the verification code image is determined;
calculating the difference between M and the obtained decoding redundancy times;
and determining the sum of the difference and the preset fault-tolerant times as a set click time threshold, wherein the set click time threshold is not more than M.
In another aspect, an embodiment of the present invention provides a login authentication apparatus, where the apparatus includes:
the receiving module is used for receiving a login verification instruction of a user to be verified;
a first obtaining module, configured to obtain a current verification code image according to the login verification instruction, where the verification code image includes a two-dimensional code image pre-divided into N two-dimensional code blocks, M two-dimensional code blocks of the N two-dimensional code blocks are covered or replaced by a preset non-two-dimensional code image, N and M are positive integers, and M is less than or equal to N;
the second obtaining module is used for obtaining the current accumulated click times of the user to be verified;
the decoding module is used for decoding the current verification code image according to the click position of the user to be verified on the current verification code image when the current accumulated click times do not exceed a set click times threshold value, so as to obtain the decoding result of the current verification code image;
and the first determining module is used for determining that the user to be verified is an illegal user when the decoding result is failure and the obtained accumulated click times of the user to be verified exceed the set click time threshold when the next login verification instruction of the user to be verified is received.
Optionally, the apparatus further comprises:
the second determining module is used for determining the user to be verified as an illegal user when the current accumulated click times exceed the set click times threshold; or
And when the decoding result is successful, determining that the user to be verified is a legal user.
Optionally, the second obtaining module is specifically configured to
According to the login verification instruction, increasing the stored accumulated click times by 1, wherein the stored accumulated click times are as follows: receiving the accumulated click times of the user to be verified in the previous login verification instruction;
taking the stored accumulated click times after the increment of 1 as the current accumulated click times of the user to be verified; or the like, or, alternatively,
obtaining the stored accumulated click times as the current accumulated click times of the user to be verified;
the device further comprises:
a first increment module, configured to increment, by 1, the current accumulated click number when the decoding result is failure after the obtained and stored accumulated click number is used as the current accumulated click number of the user to be verified; and taking the accumulated click times after 1 increment as the accumulated click times of the user to be verified, which is obtained when the next login verification instruction of the user to be verified is received.
Optionally, the apparatus further comprises:
and a second increment module, configured to increment, by 1, the accumulated click number by when the accumulated click number does not exceed the set click number threshold and the two-dimensional code block corresponding to the click position is determined to be a two-dimensional code block according to the click position after the accumulated click number of the user to be verified is obtained.
Optionally, the decoding module is specifically used for
And according to the click position, when the two-dimensional code block corresponding to the click position in the current verification code image is determined to be a non-two-dimensional code image or covered by the non-two-dimensional code image, restoring the two-dimensional code block covered or replaced by the non-two-dimensional code image, and decoding the verification code image after restoration processing.
Optionally, the apparatus further comprises:
and the replacing module is used for replacing the current verification code image with the verification code image obtained after the recovery processing is carried out on the two-dimensional code block covered or replaced by the non-two-dimensional code image, so as to be used as the current verification code image when the next login verification instruction of the user to be verified is received.
Optionally, the apparatus further comprises:
the third obtaining module is used for obtaining a two-dimensional code image to be processed before the login verification instruction of the user to be verified is received;
the segmentation module is used for segmenting the two-dimensional code image to be processed to obtain N two-dimensional code blocks;
a selecting module, configured to randomly select M two-dimensional code blocks from the N two-dimensional code blocks;
the generation module is used for covering or replacing the M two-dimensional code blocks with P non-two-dimensional code images aiming at the selected M two-dimensional code blocks to generate the verification code image, wherein P is a positive integer not larger than M;
the receiving module is particularly used for
And receiving a login verification instruction sent by a user to be verified aiming at the verification code image.
Optionally, the generating module includes:
a judging unit for judging whether the current filling operation frequency exceeds Z; wherein Z is equal to M minus 1; triggering a processing unit when judging that the current filling operation frequency does not exceed Z; when the current filling operation frequency is judged to exceed Z, triggering a first determining unit;
the processing unit is used for covering or replacing one uncovered or replaced two-dimensional code block in the M two-dimensional code blocks by using one non-two-dimensional code image in the P non-two-dimensional code images to obtain a current two-dimensional code image to be processed;
the first increasing unit is used for increasing the filling operation times by 1 to serve as the current filling operation times and trigger the judging unit;
the first determining unit is used for determining the current two-dimensional code image to be processed as the verification code image.
Optionally, the generating module further includes:
the decoding unit is used for decoding the current two-dimensional code image to be processed before the filling operation times are increased by 1 as the current filling operation times; when the current two-dimensional code image to be processed fails to be decoded, triggering the first increment unit; when the current two-dimensional code image to be processed is successfully decoded, triggering a second increasing unit;
the second incremental unit is configured to, when the current to-be-processed two-dimensional code image is successfully decoded, increment the coding redundancy number by 1, and trigger the first incremental unit, where the coding redundancy number is used to set the threshold of the set click number.
Optionally, the generating module further includes:
the obtaining unit is used for obtaining the decoding redundancy times when the verification code image is determined after the current two-dimensional code image to be processed is determined as the verification code image;
a calculating unit for calculating a difference between M and the obtained decoding redundancy number;
and the second determining unit is used for determining the sum of the difference and the preset fault-tolerant times as a set click time threshold, wherein the set click time threshold is not more than M.
In another aspect, an embodiment of the present invention provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus;
a memory for storing a computer program;
the processor is configured to implement any of the above login authentication method steps provided in the embodiments of the present invention when executing the computer program stored in the memory.
In another aspect, an embodiment of the present invention provides a computer-readable storage medium, in which a computer program is stored, and the computer program, when executed by a processor, implements any of the above-mentioned login authentication method steps provided by the embodiment of the present invention.
The login verification method provided by the embodiment of the invention comprises the following steps: receiving a login verification instruction of a user to be verified; obtaining a current verification code image according to a login verification instruction, wherein the verification code image comprises a two-dimensional code image which is divided into N two-dimensional code blocks in advance, M two-dimensional code blocks in the N two-dimensional code blocks are covered or replaced by a preset non-two-dimensional code image, N and M are positive integers, and M is smaller than or equal to N; the method comprises the steps of obtaining the current accumulated click times of a user to be verified, and decoding a current verification code image according to the click position of the user to be verified on the current verification code image when the current accumulated click times does not exceed a set click times threshold value to obtain the decoding result of the current verification code image; and when the decoding result is failure and the next login verification instruction of the user to be verified is received, and the obtained accumulated click times of the user to be verified exceed the set click times threshold, determining that the user to be verified is an illegal user.
In the embodiment of the present invention, the verification code image includes a two-dimensional code image pre-divided into N two-dimensional code blocks, and M two-dimensional code blocks are covered or replaced by a preset non-two-dimensional code image, so that a user to be verified needs to perform a click operation within a threshold number of clicks, so that the verification code image can be successfully decoded. And when the number of clicks does not exceed the set number of clicks threshold, the user to be verified fails to enable the verification code image to be successfully decoded, namely, the user to be verified is considered as an illegal user. The problems of automatic login, malicious multi-login and the like can be avoided to a certain extent, the accuracy of verification of the problems of automatic login, malicious multi-login and the like is improved, and the defense of automatic login and malicious multi-login is enhanced. Of course, it is not necessary for any product or method of practicing the invention to achieve all of the above-described advantages at the same time.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1A is a schematic structural diagram of a login authentication device according to an embodiment of the present invention;
fig. 1B is a schematic flowchart of a login authentication method according to an embodiment of the present invention;
FIG. 2A is a schematic diagram of a DM code;
FIG. 2B is a schematic diagram of a QR code;
FIG. 2C is a schematic structural diagram of a MaxiCode two-dimensional code;
fig. 3A is another schematic flow chart illustrating a login authentication method according to an embodiment of the present invention;
fig. 3B is another schematic flow chart of a login authentication method according to an embodiment of the present invention;
fig. 4A is a schematic flowchart of a process for obtaining a verification code image according to an embodiment of the present invention;
fig. 4B is a schematic diagram of dividing a two-dimensional code image into 3 × 3 rectangular two-dimensional code blocks;
fig. 4C is a schematic diagram of a verification code image obtained by performing a preset occlusion operation on 4 two-dimensional code blocks of the 3 × 3 two-dimensional code blocks shown in fig. 4B;
FIG. 4D is a schematic diagram illustrating another process for obtaining an image of a verification code according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of current post-processing authentication code images generated by successive clicks of an authentication code image;
fig. 6 is another schematic structural diagram of a login authentication device according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terms of the present invention are explained as follows:
the user to be authenticated refers to a user waiting to be authenticated whether the user is a legal user or not.
The legal user refers to a user allowed to log in by a certain website, which is called a legal user of the website or the application software, or refers to a user allowed to log in by a certain application software, which is called a legal user of the application software.
The illegal user refers to a user who is not allowed to log in by a certain website, and is called as an illegal user of the website, or refers to a user who is not allowed to log in by certain application software, and is called as an illegal user of the application software.
And the verification code image is a two-dimensional code image used for verifying the identity (illegal user or legal user) of the user to be verified.
And decoding redundancy times refer to the minimum block number of the two-dimensional code blocks which are required to be covered or replaced in the two-dimensional code image and can not be successfully decoded.
The invention concept of the invention is as follows:
as shown in fig. 1A, the login authentication apparatus provided in the embodiment of the present invention may include a splitting module, a filling module, and a user click recovery module;
the cutting module and the filling module can realize generation of the verification code image, and the user clicks the restoration module to realize login verification by using the verification code image.
The segmentation module can firstly obtain a two-dimensional code image as a to-be-processed two-dimensional code image, and segment the to-be-processed two-dimensional code image to obtain N two-dimensional code blocks.
The two-dimensional code image may be an image including a two-dimensional code, and the two-dimensional code may be any type of two-dimensional code related to the two-dimensional code. The type of the two-dimensional code is not limited.
The division of the two-dimensional code image to be processed may be an average division or a non-average division. For the above segmentation module, when the two-dimensional code image to be processed is segmented, the shape of the two-dimensional code block obtained after the segmentation may be any polygon, and the embodiment of the present invention does not limit the shape of the two-dimensional code block obtained after the segmentation. In one case, the two-dimensional code image is divided into equal rectangular two-dimensional code blocks, which is beneficial to improving the storage and operation efficiency of the electronic equipment.
The padding module may randomly select M two-dimensional code blocks from the N two-dimensional code blocks, where M may be less than or equal to N; and for the selected M two-dimensional code blocks, covering or replacing the P non-two-dimensional code images with the M two-dimensional code blocks to generate the verification code image. Wherein P may be equal to or less than M. The P non-two-dimensional code images may include: not any type of image of the two-dimensional code image. Both M, N and P are positive integers.
And the size of the non-two-dimensional code image covering or replacing the two-dimensional code block is not larger than the size of the covered or replaced two-dimensional code block. The non-two-dimensional code image covering or replacing the two-dimensional code block may be any color, pattern, and shape.
In an implementation manner, the process of generating the verification code image by the filling module may be: and directly covering or replacing the M two-dimensional code blocks by P non-two-dimensional code images aiming at the selected M two-dimensional code blocks to generate a verification code image.
In another implementation manner, the process of generating the verification code image by the filling module may be: and covering or replacing the selected M two-dimensional code blocks block by block. Specifically, the method comprises the following steps: judging whether the current filling operation frequency exceeds Z; wherein Z is equal to M minus 1; when the current filling operation frequency is judged not to exceed Z, covering or replacing one uncovered or replaced two-dimensional code block in the M two-dimensional code blocks by using one non-two-dimensional code image in the P non-two-dimensional code images to obtain a current two-dimensional code image to be processed; the filling operation frequency is increased by 1 as the current filling operation frequency, and the step of judging whether the current filling operation frequency exceeds Z is returned; and when the current filling operation times are judged to exceed Z, determining the current two-dimensional code image to be processed as the verification code image.
Subsequently, the filling module may set the value obtained by subtracting M from M to a set click number threshold, where the specific setting condition is described later. In the process of login verification by using the verification code image, the user clicks the recovery module, and the condition that the illegal user is mistaken for the legal user can be avoided by limiting the number of times of clicking the verification code image by the user to be verified, so that the illegal user can avoid attempting to click the verification code image for multiple times randomly, and the verification code image clicked for multiple times can be decoded successfully. The problems of automatic login, malicious multiple login and the like are avoided to a certain extent. In one case, both automatic login and malicious multiple login are typically machine login, and the user click recovery module can be used to distinguish between human login and machine (non-human) login by limiting the number of clicks on the authentication code image by the user to be authenticated.
The current two-dimensional codes have fault tolerance, namely, partial contents of a two-dimensional code image are blocked, and the two-dimensional code image can still be successfully decoded. Based on the fault tolerance of the two-dimensional code, the verification code image is successfully decoded, and it is not necessarily required that all covered or replaced two-dimensional code blocks are subjected to recovery processing, that is, are recovered. The number of the two-dimensional code blocks that may need to be clicked by the user, that is, the number of the two-dimensional code blocks subjected to the recovery processing may be smaller than M, that is, smaller than the number of the covered or replaced two-dimensional code blocks, so that the login verification may be passed.
In view of the above situation, in order to set a relatively reasonable threshold for the number of clicks, it is avoided that an illegal user tries to randomly click the verification code image multiple times, so that the verification code image clicked multiple times can be successfully decoded, and the illegal user is mistaken for a legal user. Moreover, the situation that the user to be verified is determined as an illegal user by mistake due to the fact that the set click number threshold is unreasonable, for example, the set click number threshold is too small, is avoided.
In another implementation manner, in the process of generating the verification code image by the filling module, after covering or replacing one two-dimensional code block in the to-be-processed two-dimensional code image each time, decoding the obtained current to-be-processed two-dimensional code image to determine whether the decoding is successful, and when the decoding of the current to-be-processed two-dimensional code image fails, returning to the step of increasing the filling operation frequency by 1 as the current filling operation frequency; and when the current to-be-processed two-dimensional code image is successfully decoded, the decoding redundancy times are increased by 1, and the filling operation times are returned and increased by 1 as the current filling operation times. Based on the process, the decoding redundancy times can be determined, namely the minimum block number of the two-dimensional code blocks which are required to be covered or replaced in the two-dimensional code image and can not be successfully decoded is determined. Furthermore, the decoding redundancy times can be used for setting a click time threshold value so as to limit the click times of the user to be verified on the verification code image.
The user clicks the restoration module, so as to obtain the verification code image generated by the filling module and the set click number threshold set by the filling module. In an implementation manner, the user click recovery module is disposed in the terminal, and at this time, the user click recovery module may continue to display the verification code image to the user to be verified, so that the user to be verified can click on the verification code image, that is, perform verification. In another implementation manner, the user click recovery module is disposed in the server, and at this time, the user click recovery module may be configured to send the verification code image to the terminal, so that the terminal displays the verification code image to the user to be verified, and the user to be verified may click on the verification code image to perform login verification.
The user click recovery module may include a receiving sub-module, a first obtaining sub-module, a second obtaining sub-module, and a first determining sub-module in the process of implementing login verification;
the receiving submodule is used for receiving a login verification instruction of a user to be verified. In one implementation, the login verification instruction may be: and the user to be verified clicks the displayed verification code image to trigger the instruction. It can also be: and the user to be verified operates the function key of the login interface of the website or the application software to trigger the instruction.
And the first obtaining sub-module is used for obtaining the current verification code image according to the login verification instruction and sending the current verification code image to the second obtaining sub-module. The verification code image comprises a two-dimensional code image which is divided into N two-dimensional code blocks in advance, M two-dimensional code blocks in the N two-dimensional code blocks are covered or replaced by preset non-two-dimensional code images, N and M are positive integers, and M is smaller than or equal to N.
The current verification code image may be an image generated by clicking a previous verification code image by a user to be verified. In one case, the current verification code image and the previous verification code image may correspond to the same two-dimensional code image; in another case, the current verification code image and the previous verification code image may correspond to different two-dimensional code images.
The second obtaining submodule may include an obtaining unit and a decoding unit; wherein the content of the first and second substances,
the obtaining unit is used for obtaining the current accumulated click times of the user to be verified and sending the current accumulated click times to the decoding unit, and the decoding unit decodes the current verification code image according to the click position of the user to be verified on the current verification code image when determining that the current accumulated click times does not exceed the set click times threshold value, obtains the decoding result of the current verification code image, and sends the decoding result to the first determining submodule.
In one case, the current accumulated number of clicks may be an accumulated number of clicks after incrementing the stored accumulated number of clicks by 1 based on the login authentication instruction. Alternatively, the accumulated click times may be stored, where the accumulated click times are: and receiving the accumulated click times of the user to be authenticated when the user logs in the authentication instruction last time. When the current accumulated click number is the stored accumulated click number, and after the decoding result of the current verification code image is obtained, the first determining submodule may increment the current accumulated click number by 1 when the decoding result is determined to be a failure, and the current accumulated click number is used as the accumulated click number of the user to be verified, which is obtained when the next login verification instruction of the user to be verified is received.
In one case, when the two-dimensional code block corresponding to the click position of the user to be verified on the verification code image is a non-two-dimensional code image or is covered by the non-two-dimensional code image, the two-dimensional code block covered or replaced by the non-two-dimensional code image is restored, and the verification code image after restoration processing is decoded to obtain the current decoding result of the verification code image. When the two-dimensional code block corresponding to the click position of the user to be verified on the verification code image is a two-dimensional code block, a subsequent decoding process may not be performed in order to reduce the operation burden.
Subsequently, the current verification code image may be replaced with the verification code image obtained after the recovery processing, so as to be used as the current verification code image when the next login verification instruction of the user to be verified is received.
In one implementation manner, when determining that the current accumulated click times exceeds the set click times threshold, the decoding unit may directly determine that the user to be authenticated is an illegal user.
And when the first determining submodule determines that the decoding result is failure and receives a next login verification instruction of the user to be verified, and the obtained accumulated click times of the user to be verified exceed a set click time threshold, determining that the user to be verified is an illegal user.
And when the first determining submodule determines that the decoding result is successful, determining that the user to be verified is a legal user.
In one case, the determining that the user to be authenticated is an illegal user may be: and forbidding the user to be authenticated to continue login authentication. Or forbidding the user to be authenticated to continue login authentication within a preset time length. Or, regenerating a new verification code image, so that the user to be verified logs in and verifies again based on the new verification code image. At this time, the accumulated clicks are accumulated again from 0.
Based on the above scheme, the verification code image includes a two-dimensional code image pre-divided into N two-dimensional code blocks, and M two-dimensional code blocks are covered or replaced by a preset non-two-dimensional code image, and a user to be verified needs to perform a click operation within a threshold number of clicks, so that the verification code image can be successfully decoded. And when the number of clicks does not exceed the set number of clicks threshold, the user to be verified fails to enable the verification code image to be successfully decoded, namely, the user to be verified is considered as an illegal user. The problems of automatic login, malicious multi-login and the like can be avoided to a certain extent, the accuracy of verification of the problems of automatic login, malicious multi-login and the like is improved, and the defense of automatic login and malicious multi-login is enhanced.
Based on the same inventive concept, the embodiment of the invention provides a login verification method, a login verification device and electronic equipment, so that the verification accuracy of the problems of automatic login, malicious multiple login and the like is improved, and the defense of the automatic login and the malicious multiple login is enhanced.
As shown in fig. 1B, an embodiment of the present invention provides a login authentication method, which may include the following steps:
s101: receiving a login verification instruction of a user to be verified;
it can be understood that the login authentication method provided by the embodiment of the present invention can be applied to any terminal that can provide functions of logging in a website and/or application software, and the terminal can be a computer, a smart phone, and the like. The server may be a computer, a smart phone, or the like, connected to the terminal that can provide functions of registering a website and/or application software. The application software for implementing the login verification method provided by the embodiment of the invention can exist in the form of special client software, and also can exist in the form of a website (application software on which the website depends) which needs to be logged in at present or a plug-in of the application software.
In one implementation, the login verification instruction may be: and the user to be verified clicks the displayed verification code image to trigger the instruction. It can also be: and the user to be verified operates the function key of the login interface of the website or the application software to trigger the instruction. In one case, the verification code image may be displayed in a login interface of a website or application software, the login interface may be provided with an input window for login information, and the login information may include: login account number, login password and the like.
S102: obtaining a current verification code image according to the login verification instruction;
the verification code image comprises a two-dimensional code image which is divided into N two-dimensional code blocks in advance, M two-dimensional code blocks in the N two-dimensional code blocks are covered or replaced by preset non-two-dimensional code images, N and M are positive integers, and M is smaller than or equal to N;
it should be understood that the two-dimensional code image is an image including a two-dimensional code, and in the embodiment of the present invention, the two-dimensional code may be a dm (data matrix) code, a qr (quick response) code, a MaxiCode two-dimensional code, or the like. The DM code is named as Data code.
The structures of different types of two-dimensional codes may be different. For example: for the DM code, the DM code includes an L-side solid line, a version number dotted line, and data information, where a region where the data information of the two-dimensional code is located may be referred to as a data region of the two-dimensional code, and the L-side solid line and the version number dotted line may be referred to as a position detection pattern of the two-dimensional code. As shown in fig. 2A, from left to right, the following are in sequence: the DM code includes a structural diagram of an area where the L-side solid line is located, an area where the version number dotted line is located, and a data area. Another example is: for a QR code, the QR code comprises a plurality of versions, and the structures of the QR codes of different versions are different; in summary, a QR code may include: a dead zone, a position detection pattern, a correction pattern (version 1 none), a reference grid, version information, format information, and data information. As shown in fig. 2B, from left to right, the following are in sequence: the schematic structure diagram of the QR code of version 1, the schematic structure diagram of the QR code of version 2, and the schematic structure diagram of the QR code of version 7. Another example is: the MaxiCode two-dimensional code, as shown in fig. 2C, is a schematic structural diagram of the MaxiCode two-dimensional code, and includes a position detection pattern, a direction correction pattern, a data area, a retention module, and a quiet area, which are two-dimensional codes with fixed sizes, fixed data capacities, and fixed data arrangement sequences, as shown in fig. 2C, the minimum module of the MaxiCode two-dimensional code has a hexagonal shape.
In this step, the current verification code image may be a verification code image that has not been clicked by the user to be verified, or may also be a verification code image that has been clicked by the user to be verified X times, where X is a positive integer greater than or equal to 1, and X does not exceed M.
The preset non-two-dimensional code image may be any type of image not including a two-dimensional code, or may be: an image containing a two-dimensional code of a different type from the two-dimensional code image contained in the verification image. And the size of the preset non-two-dimensional code image is not larger than the size of the covered or replaced two-dimensional code block. The preset non-two-dimensional code image can be in any color, pattern and shape.
S103: obtaining the current accumulated click times of a user to be verified;
s104: when the current accumulated click times do not exceed a set click times threshold, decoding the current verification code image according to the click position of the user to be verified on the current verification code image to obtain the decoding result of the current verification code image;
in an implementation manner, after obtaining the current cumulative click number of the user to be authenticated, the current cumulative click number and the size of the set click number threshold may be determined, where S104 is triggered when the current cumulative click number does not exceed the set click number threshold. In another implementation manner, when the current accumulated click times exceeds a set click times threshold, it may be determined that the user to be authenticated is an illegal user.
The accumulated click times are as follows: and counting the number of times that the user to be verified clicks the verification code image comprising a certain two-dimensional code image, wherein the two-dimensional code image is pre-divided into N two-dimensional code blocks, and M two-dimensional code blocks in the N two-dimensional code blocks are covered or replaced by a preset non-two-dimensional code image.
It can be understood that, when the login verification instruction is a triggered instruction in which the user to be verified clicks the verification code image displayed by the click terminal, the login verification instruction includes a click position at which the user to be verified clicks the displayed verification code image. The server or the terminal can decode the current verification code image according to the click position of the user to be verified on the verification code image to obtain the decoding result of the current verification code image.
The current verification code image can be decoded by calling a preset two-dimensional code recognition algorithm, so that the decoding result of the current verification code image is obtained. The preset two-dimensional code recognition algorithm may be any related algorithm capable of recognizing a two-dimensional code, and the preset two-dimensional code recognition algorithm is not limited in the embodiment of the present invention.
In one implementation manner, the step of decoding the current verification code image according to the click position of the user to be verified on the current verification code image may include:
and according to the click position, when the two-dimensional code block corresponding to the click position in the current verification code image is determined to be a non-two-dimensional code image or covered by the non-two-dimensional code image, restoring the two-dimensional code block covered or replaced by the non-two-dimensional code image, and decoding the verification code image after restoration processing.
When it is determined that the two-dimensional code block corresponding to the click position in the current verification code image is a non-two-dimensional code image, the process of performing recovery processing on the two-dimensional code block covered or replaced by the non-two-dimensional code image may be: obtaining the corresponding relation between the positions of the stored two-dimensional code blocks in the verification code image and the two-dimensional code blocks, determining the two-dimensional code blocks corresponding to the click positions based on the corresponding relation and the click positions in the current verification code image, replacing the non-two-dimensional code image at the click positions with the two-dimensional code blocks corresponding to the determined click positions,
when it is determined that the two-dimensional code block corresponding to the click position in the current verification code image is covered by the non-two-dimensional code image, the process of performing recovery processing on the two-dimensional code block covered or replaced by the non-two-dimensional code image may be: and deleting the covered non-two-dimensional code image.
In one case, after the step of performing the restoration process on the two-dimensional code block covered or replaced by the non-two-dimensional code image, the method may further include:
and replacing the current verification code image with the verification code image obtained after recovery processing to serve as the current verification code image when the next login verification instruction of the user to be verified is received.
It can be understood that after the recovery processing is performed on the two-dimensional code blocks covered or replaced by the non-two-dimensional code image, the verification code image obtained after the recovery processing can be obtained. When the verification code image obtained after the recovery processing is decoded and the decoding result is failure, the next round of login verification needs to be continued, and at this time, the current verification code image can be replaced by the verification code image obtained after the recovery processing to be used as the current verification code image when the next login verification instruction of the user to be verified is received.
In another implementation, when the two-dimensional code block corresponding to the click position in the current verification code image is determined to be a two-dimensional code block according to the click position, in order to reduce the operation burden, the current verification code image may not be decoded. At this time, the current verification code image may be directly used as the current verification code image when the next login verification instruction of the user to be verified is received.
S105: and when the decoding result is failure and the next login verification instruction of the user to be verified is received, and the obtained accumulated click times of the user to be verified exceed the set click times threshold, determining that the user to be verified is an illegal user.
When the decoding result is failure, receiving a next login verification instruction of the user to be verified, obtaining the accumulated click times of the user to be verified when the next login verification instruction of the user to be verified is received, and further comparing the obtained accumulated click times of the user to be verified when the next login verification instruction of the user to be verified is received with the size of a set click time threshold; and when the obtained accumulated click times of the user to be verified when the user to be verified receives the next login verification instruction of the user to be verified exceeds the set click time threshold, determining that the user to be verified is an illegal user.
In one case, the above process of determining that the user to be authenticated is an illegal user may be: and forbidding the user to be authenticated to continue login authentication. Or forbidding the user to be authenticated to continue login authentication within a preset time length. Or, regenerating a new verification code image, that is, re-executing the subsequent verification code image generation process, so that the user to be verified logs in and verifies based on the new verification code image again, and at this time, the accumulated clicks will start to be accumulated again.
In another implementation, when the decoding result is successful, it may be determined that the user to be authenticated is a legitimate user. In one case, after determining that the user to be authenticated is a valid user, information such as "authentication success" or "authentication pass" may be output, or, after detecting that the user to be authenticated has input a correct login account and a login password corresponding to the login account, directly jump to an interface corresponding to the login account to which the user to be authenticated has logged in.
In another implementation manner, when the decoding result is failure and the next login authentication instruction of the user to be authenticated is received, and the obtained accumulated click times of the user to be authenticated exceeds the set click times threshold, the subsequent login authentication process may be continuously executed. It can be understood that, when the decoding result is failure, the login authentication instruction of the user to be authenticated may be returned to be executed, where the login authentication instruction of the user to be authenticated is actually the next login authentication instruction described above when the return execution receives the login authentication instruction of the user to be authenticated. When the current accumulated click times, namely the accumulated click times obtained when the next login verification instruction of the user to be verified is received, is determined, the current verification code image is decoded according to the click position of the user to be verified on the current verification code image (the verification code image when the user to be verified logs in the verification instruction next time) when the accumulated click times does not exceed the set click times threshold, so that the decoding result of the current verification code image is obtained, and further, the subsequent flow is executed based on the decoding result.
In the embodiment of the present invention, the verification code image includes a two-dimensional code image pre-divided into N two-dimensional code blocks, and M two-dimensional code blocks are covered or replaced by a preset non-two-dimensional code image, so that a user to be verified needs to perform a click operation within a threshold number of clicks, so that the verification code image can be successfully decoded. And when the number of clicks does not exceed the set number of clicks threshold, the user to be verified fails to enable the verification code image to be successfully decoded, namely, the user to be verified is considered as an illegal user. The problems of automatic login, malicious multi-login and the like can be avoided to a certain extent, the accuracy of verification of the problems of automatic login, malicious multi-login and the like is improved, and the defense of automatic login and malicious multi-login is enhanced.
In addition, in the embodiment of the present invention, the verification code image cannot be automatically identified and decoded before the recovery processing is not performed. The user to be authenticated is allowed to perform certain simple and correct operation, namely, click operation is performed on M two-dimensional code blocks covered or replaced by preset non-two-dimensional code images in the authentication code image, and the authentication code image can be successfully and automatically identified and decoded only by login authentication when the click operation does not exceed a set click time threshold, so that the user to be authenticated is determined to be a legal user.
In addition, the two-dimension code image is used as a login verification basis in the embodiment of the invention, the implementation is simple, the two-dimension code image can be dynamically generated at any time, the verification code image is further generated, background storage is not needed, and the storage space of the electronic equipment can be reduced.
In the embodiment of the present invention, after receiving the login verification instruction of the user to be verified, when obtaining the current accumulated click frequency of the user to be verified, the stored accumulated click frequency may be updated directly according to the received login verification instruction, that is, the stored accumulated click frequency is incremented by 1, and then the accumulated click frequency incremented by 1 is used as the current accumulated click frequency, so as to execute the subsequent process. Or, the stored accumulated click times can be directly used as the current accumulated click times to execute the subsequent flow; after the decoding result of the current verification code image is determined to be failed, before a next login verification instruction of the user to be verified is received, the current accumulated click times are increased by 1, and then the current accumulated click times after the increase of 1 are used as the accumulated click times of the user to be verified, which are obtained when the next login verification instruction of the user to be verified is received.
Specifically, in one implementation, as shown in fig. 3A, the method may include the following steps:
S301A: receiving a login verification instruction of a user to be verified;
S302A: obtaining a current verification code image according to the login verification instruction;
the verification code image comprises a two-dimensional code image which is divided into N two-dimensional code blocks in advance, M two-dimensional code blocks in the N two-dimensional code blocks are covered or replaced by preset non-two-dimensional code images, N and M are positive integers, and M is smaller than or equal to N;
S301A is the same as S101 shown in fig. 1B, and S302A is the same as S102 shown in fig. 1B.
S303A: according to the login verification instruction, increasing the stored accumulated click times by 1;
the stored accumulated click times are as follows: receiving the accumulated click times determined when the previous login verification instruction of the user to be verified is received;
S304A: taking the accumulated click times after 1 increment as the current accumulated click times of the user to be verified;
the above-mentioned S303A to S304A are an implementation manner of S103 shown in fig. 1B.
S305A: when the current accumulated click times do not exceed a set click times threshold, decoding the current verification code image according to the click position of the user to be verified on the current verification code image to obtain the decoding result of the current verification code image;
S306A: when the decoding result is failure and the next login verification instruction of the user to be verified is received, and the obtained accumulated click times of the user to be verified exceed a set click time threshold value, determining that the user to be verified is an illegal user;
the above S305A is the same as S104 shown in fig. 1B, and the above S306A is the same as S105 shown in fig. 1B.
In one case, as shown in fig. 3A, the method may further include:
S307A: when the decoding result is successful, determining that the user to be verified is a legal user;
S308A: and when the current accumulated click times exceed a set click times threshold value, determining that the user to be verified is an illegal user.
In another implementation, as shown in fig. 3B, the method may include the steps of:
S301B: receiving a login verification instruction of a user to be verified;
S302B: obtaining a current verification code image according to the login verification instruction;
the verification code image comprises a two-dimensional code image which is divided into N two-dimensional code blocks in advance, M two-dimensional code blocks in the N two-dimensional code blocks are covered or replaced by preset non-two-dimensional code images, N and M are positive integers, and M is smaller than or equal to N;
S301B is the same as S101 shown in fig. 1B, and S302B is the same as S102 shown in fig. 1B.
S303B: obtaining the stored accumulated click times as the current accumulated click times of the user to be verified;
the stored accumulated click times are as follows: receiving the accumulated click times determined when the previous login verification instruction of the user to be verified is received;
the above S303B is an implementation manner of S103 shown in fig. 1B.
S304B: when the current accumulated click times do not exceed a set click times threshold, decoding the current verification code image according to the click position of the user to be verified on the current verification code image to obtain the decoding result of the current verification code image;
S304B is the same as S104 shown in fig. 1B.
S305B: when the decoding result is failure, increasing the current accumulated click times by 1;
S306B: taking the accumulated click times after the increment of 1 as the accumulated click times of the user to be verified, which is obtained when the next login verification instruction of the user to be verified is received;
S307B: when a next login verification instruction of a user to be verified is received, and the obtained accumulated click times of the user to be verified exceed a set click time threshold, determining that the user to be verified is an illegal user;
S307B is the same as S105 shown in fig. 1B.
In one case, as shown in fig. 3B, the method may further include:
S308B: when the decoding result is successful, determining that the user to be verified is a legal user;
S309B: and when the current accumulated click times exceed a set click times threshold value, determining that the user to be verified is an illegal user.
In one implementation, the step of obtaining the current accumulated number of clicks of the user to be authenticated includes: when the stored accumulated click times are used as the current accumulated click times of the user to be verified, and the current accumulated click times do not exceed a set click times threshold, and the two-dimensional code block corresponding to the click position is determined to be the two-dimensional code block according to the click position, the two-dimensional code block of the click position does not need to be recovered, the current verification code image does not need to be decoded, and the operation burden can be reduced to a certain extent. At this time, the current cumulative number of clicks may be incremented by 1. And then taking the current verification code image as the current verification code image when receiving the next login verification instruction of the user to be verified, and simultaneously taking the current accumulated click times after 1 increment as the current accumulated click times when receiving the next login verification instruction of the user to be verified. For the next round of login authentication.
In one implementation, as shown in fig. 4A, before the step of receiving the login authentication instruction of the user to be authenticated, the method may further include a process of obtaining an authentication code image, where the process may include:
S401A: obtaining a two-dimensional code image to be processed;
S402A: segmenting a two-dimensional code image to be processed to obtain N two-dimensional code blocks;
S403A: randomly selecting M two-dimensional code blocks from the N two-dimensional code blocks;
S404A: for the selected M two-dimensional code blocks, covering or replacing the P non-two-dimensional code images with the M two-dimensional code blocks to generate verification code images;
wherein P is a positive integer not greater than M;
the step of receiving the login authentication instruction of the user to be authenticated may include:
and receiving a login authentication instruction sent by a user to be authenticated aiming at the authentication code image.
The to-be-processed two-dimensional code image can be an image containing any type of two-dimensional code; the to-be-processed two-dimensional code image may be pre-stored, or may be generated instantly by using an associated two-dimensional code generator.
In the embodiment of the invention, after the to-be-processed two-dimensional code image is segmented to obtain the N two-dimensional code blocks, M two-dimensional code blocks can be randomly selected from the N two-dimensional code blocks, and each two-dimensional code block in the M two-dimensional code blocks is covered or replaced respectively to obtain the verification code image. And subsequently realizing login verification of the user to be verified based on the verification code image.
Wherein, at M two-dimensional code blocks to selecting, with P non-two-dimensional code image cover or the in-process of replacing M two-dimensional code blocks, the relative position between above-mentioned each two-dimensional code block can not change all the time to in guaranteeing subsequent sign-on verification flow, can be when the two-dimensional code block that the click position corresponds is non-two-dimensional code image or by when non-two-dimensional code image covers, can carry out the recovery processing with the two-dimensional code block that non-two-dimensional code image covered or replaced, determine the just true two-dimensional code block that this click position corresponds promptly. Furthermore, the verification code image can be successfully decoded when the user to be verified performs correct operation, namely, within the click operation of the set click times threshold.
The embodiment of the present invention does not limit the dividing manner for dividing the to-be-processed two-dimensional code image, and may perform average division on the to-be-processed two-dimensional code image, for example: averagely dividing the two-dimensional code image to be processed into Y x T two-dimensional code blocks, wherein Y and T are integers which are more than or equal to 1, Y and T are not equal to 1 at the same time, and when Y is equal to T, the two-dimensional code image to be processed can be divided into Y x Y two-dimensional code blocks; or, the to-be-processed two-dimensional code image may be subjected to uneven segmentation.
In one case, the shape of the two-dimensional code blocks obtained after the segmentation of the two-dimensional code image to be processed is not limited, and the two-dimensional code blocks may be any polygon. Of course, in order to better save the operation burden of the electronic device, the to-be-processed two-dimensional code image may be equally divided into N rectangular two-dimensional code blocks. In one case, the values of N may be set to 9, that is, the to-be-processed two-dimensional code image may be divided into 3 × 3 rectangular two-dimensional code blocks, as shown in fig. 4B, which is a schematic diagram of dividing the to-be-processed two-dimensional code image into 3 × 3 rectangular two-dimensional code blocks. In one case, after the 3 × 3 two-dimensional code blocks are obtained, M two-dimensional code blocks may be randomly selected, and for the selected M two-dimensional code blocks, P non-two-dimensional code images are covered or replaced with the M two-dimensional code blocks to generate a verification code image, where M may be 4, as shown in fig. 4C, in order to cover or replace 4 two-dimensional code blocks in the 3 × 3 two-dimensional code blocks shown in fig. 4B, an illustration of the obtained verification code image is obtained.
The above-mentioned numerical values of N and M may be preset by a user, or may be set by default by the device, and after the device obtains the to-be-processed two-dimensional code image, the device may segment the obtained to-be-processed two-dimensional code image based on the set numerical values of N and M, and cover or replace the segmented M two-dimensional code blocks. Wherein, the larger the values of M and N are, the more difficult the verification code image is illegally decoded, i.e. illegally decoded.
The two-dimensional code blocks which need to be covered or replaced are selected in a random selection mode, the randomness of the obtained verification code images can be improved, the difficulty of decoding the verification code images can be improved to a certain extent, the problems of automatic login, malicious multiple login and the like can be better avoided, the accuracy of verification of the problems of automatic login, malicious multiple login and the like is improved, and the defense to the automatic login and the malicious multiple login is enhanced.
In an implementation manner, the process of generating the verification code image may be: and directly covering or replacing the M two-dimensional code blocks by P non-two-dimensional code images aiming at the selected M two-dimensional code blocks to generate a verification code image.
In another implementation, the following may be: and covering or replacing the selected M two-dimensional code blocks block by block. Specifically, the method comprises the following steps:
the step of generating the verification code image by covering or replacing the P non-two-dimensional code images with the M two-dimensional code blocks for the selected M two-dimensional code blocks includes:
judging whether the current filling operation frequency exceeds Z; wherein Z is equal to M minus 1; when the current filling operation frequency is judged not to exceed Z, covering or replacing one uncovered or replaced two-dimensional code block in the M two-dimensional code blocks by using one non-two-dimensional code image in the P non-two-dimensional code images to obtain a current two-dimensional code image to be processed; the filling operation frequency is increased by 1 as the current filling operation frequency, and the step of judging whether the current filling operation frequency exceeds Z is returned; and when the current filling operation times are judged to exceed Z, determining the current two-dimensional code image to be processed as the verification code image.
In another implementation, consideration is given to the fault tolerance of the two-dimensional code image. The verification code image is successfully decoded, and it is not necessarily required that all the covered or replaced two-dimensional code blocks are subjected to recovery processing, i.e., restored. The number of the two-dimensional code blocks that may need to be clicked by the user, that is, the number of the two-dimensional code blocks subjected to the recovery processing may be smaller than M, that is, smaller than the number of the covered or replaced two-dimensional code blocks, so that the login verification may be passed. The reasonable threshold value of the set click times can be set by utilizing the fault tolerance of the two-dimensional code, so that the problems of automatic login, multiple times of malicious login and the like can be better defended, the verification code image is prevented from being clicked by multiple times of malicious operations, and the verification code image can be successfully and automatically identified and decoded after being clicked by multiple times of malicious operations.
Based on the above situation, in order to set a relatively reasonable threshold for the number of clicks, it is avoided that an illegal user tries to randomly click the verification code image multiple times, so that the verification code image clicked multiple times can be successfully decoded, and the illegal user is mistaken for a legal user. Moreover, the situation that the user to be verified is determined as an illegal user by mistake due to the fact that the set click number threshold is unreasonable, for example, the set click number threshold is too small, is avoided. The decoding redundancy number may be determined by determining the minimum number of blocks of the two-dimensional code blocks to be covered or replaced in the two-dimensional code image, which makes the two-dimensional code image unable to be decoded successfully. Furthermore, the threshold value of the number of clicks is set by using the decoding redundancy number. To limit the number of clicks of the authentication code image by the user to be authenticated.
As shown in fig. 4D, the step of generating the verification code image by covering or replacing the P non-two-dimensional code images with the M two-dimensional code blocks to the selected M two-dimensional code blocks may include:
S401D: judging whether the current filling operation frequency exceeds Z; where Z is equal to M minus 1, when it is judged that the current number of filling operations does not exceed Z, S402D is executed; when it is judged that the current number of filling operations exceeds Z, S406D is executed;
S402D: covering or replacing one uncovered or replaced two-dimensional code block in the M two-dimensional code blocks by using one non-two-dimensional code image in the P non-two-dimensional code images to obtain a current two-dimensional code image to be processed;
S403D: decoding the current two-dimensional code image to be processed; when the decoding of the current to-be-processed two-dimensional code image fails, S404D is executed; when the decoding of the current to-be-processed two-dimensional code image is successful, S405D is executed;
S404D: the number of filling operations is incremented by 1 as the current number of filling operations, returning to S401D;
S405D: the decoding redundancy number is increased by 1 and returns to the step S404D, wherein the decoding redundancy number is used for setting a set click number threshold;
S406D: and determining the current two-dimensional code image to be processed as a verification code image.
In one case, the current two-dimensional codes have fault tolerance, that is, when partial contents of the two-dimensional codes are blocked, the possibility of being successfully identified and decoded still exists. In view of the fault tolerance of the two-dimensional code, in order to avoid the situation that the verification code image can be successfully and automatically identified and decoded by clicking operation when the user to be verified does not perform the verification operation, the setting of M is very important when determining the verification code image, and M may be: the user presets a numerical value according to an empirical value, which may be provided by a developer of application software implementing the login authentication method provided by the embodiment of the present invention. The empirical value may be set by a developer according to the fault tolerance of the two-dimensional code, and the developer sets the N two-dimensional code blocks into which the two-dimensional code image to be processed is divided. For example, when the two-dimensional code image to be processed is divided into 9(3 × 3) two-dimensional code blocks, and the fault tolerance of the two-dimensional code is 10%, the above empirical value may be set to 2, that is, M may be set to any integer value between 2 and 9, 2, and 9.
In the embodiment of the present invention, the set threshold of the number of clicks may be used to limit the maximum number of clicks of the authentication code image by the allowed user to be authenticated, and the setting is very important for login authentication. In one case, after receiving a login authentication instruction of a user to be authenticated, that is, when the stored accumulated number of clicks is incremented by 1 according to the login authentication instruction, the M may be directly set as the set threshold of the number of clicks. In another case, after receiving a login authentication instruction of a user to be authenticated, when the stored cumulative click times are used as the current cumulative click times, the value of M may be directly decreased by one to be set as a threshold value of the set click times.
It can be understood that, through the process shown in fig. 4D, when the verification code image is obtained, the number of filling operations, that is, M, and the number of decoding redundancies when the verification code image is obtained can be obtained at the same time, and according to the number of filling operations, that is, M, and the number of decoding redundancies when the verification code image is obtained, the user minimum click number can be obtained by calculation, where the user minimum click number can be characterized: the verification code image can be successfully identified and decoded, and the minimum number of times of clicking by a user is provided. The specific user minimum click times are equal to the filling operation times, namely the difference between M and the decoding redundancy times.
In one case, after receiving a login verification instruction of a user to be verified, that is, when the stored accumulated number of clicks is incremented by 1 according to the login verification instruction, the minimum number of clicks of the user may be directly determined as the set threshold of the number of clicks. In another case, after receiving a login authentication instruction of a user to be authenticated, when the stored cumulative click times are used as the current cumulative click times, the minimum click times of the user may be directly reduced by one to be set as a set click times threshold.
In another situation, a user inevitably has a point error in the operation process, that is, clicks a two-dimensional code block in the verification code image that is not covered or replaced by the non-two-dimensional code image, at this time, a preset fault-tolerant number may be preset, where the preset fault-tolerant number is used to represent the maximum number of times that the user is allowed to perform the point error on the verification code image. The set click number threshold value can be determined based on the minimum click number of the user and the preset fault-tolerant number, so that the maximum number of times that the user can click on the verification code image can be limited.
In view of the above, after the step of determining the current two-dimensional code image to be processed as the verification code image, the method may further include:
acquiring the decoding redundancy times when the verification code image is determined;
calculating the difference between M and the obtained decoding redundancy times;
and determining the sum of the difference and the preset fault-tolerant times as a set click time threshold, wherein the set click time threshold is not more than M.
The time for determining the sum of the difference and the preset fault-tolerant times as the threshold of the set click times is as follows: and after receiving a login verification instruction of a user to be verified, increasing the stored accumulated click times by 1 according to the login verification instruction. In another case, when the stored cumulative click number is used as the current cumulative click number after receiving the login authentication instruction of the user to be authenticated, the sum may be subtracted by one to determine as the set click number threshold. Wherein the sum is: the sum of the difference value and the preset fault-tolerant times.
According to the embodiment of the invention, the click times of the user to be verified on the verification code image are limited, the problems of automatic login, malicious multiple login and the like are avoided, the condition of allowing the user to be verified to miss the click can be realized to a certain degree, and the user experience can be improved to a certain degree.
The following specific embodiments are used to describe a login authentication method provided in the embodiments of the present invention: assume that the method applies to a server; after receiving a login instruction of a user to be authenticated, a server may generate a first verification code image, as shown in fig. 5, a left-side "diagram a" is a first verification code image obtained by using a verification code image obtaining manner provided by an embodiment of the present invention, where the first verification code image includes 9 two-dimensional code blocks, which are sequentially a block 1, a block 2, a block 3, a block 4, a block 5, a block 6, a block 7, a block 8, and a block 9 from top to bottom and from left to right, where the block 1, the block 3, the block 5, and the block 8 are two-dimensional code blocks covered or replaced by a preset non-two-dimensional code image;
in one case, assume that the threshold number of clicks is set to 4;
the server sends the first verification code image to a terminal held by a user to be verified, the terminal displays the first verification code image for the user to be verified to click, the first verification code image of the user to be verified is clicked, and a login verification instruction is triggered;
receiving a login verification instruction of a user A to be verified;
obtaining a current verification code image, namely 'image a', according to a login verification instruction;
obtaining the current accumulated click times of a user to be verified, namely 0;
at this time, the current accumulated click times 0 do not exceed a set click times threshold 4, and the current verification code image is decoded according to the click position of the user to be verified on the current verification code image to obtain the decoding result of the current verification code image; when the click position of a user to be verified on the current verification code image is the position of a block 5 of a verification code image I shown in a figure a, a two-dimensional code block corresponding to the position of the block 5 is a covered or replaced non-two-dimensional code image, at this time, the two-dimensional code block covered or replaced by the non-two-dimensional code image is subjected to recovery processing, the verification code image subjected to the recovery processing is decoded, and then a figure b shown in a figure 5 is decoded;
when the decoding fails, increasing the current accumulated click times by 1; and can send the verification code image 'picture b' after recovery processing to the terminal, the terminal displays the verification code image 'picture b' after recovery processing, the user to be verified clicks the 'picture b',
receiving a login verification instruction of a user to be verified;
obtaining a current verification code image, namely 'image b', according to a login verification instruction;
obtaining the current accumulated click times of a user to be verified, namely 1;
at this time, the current accumulated click times 1 do not exceed a set click times threshold 4, and the current verification code image is decoded according to the click position of the user to be verified on the current verification code image to obtain the decoding result of the current verification code image; when the click position of a user to be verified on the current verification code image is the position of a block 1 of a verification code image I shown in a figure a, a two-dimensional code block corresponding to the position of the block 1 is a covered or replaced non-two-dimensional code image, at this time, the two-dimensional code block covered or replaced by the non-two-dimensional code image is subjected to recovery processing, the verification code image subjected to the recovery processing is decoded, and then a figure c shown in a figure 5 is decoded;
when the decoding fails, increasing the current accumulated click times by 1; the verification code image graph c after recovery processing can be sent to a terminal, the terminal displays the verification code image graph c after recovery processing, and a user to be verified clicks the graph c;
receiving a login verification instruction of a user to be verified;
obtaining a current verification code image, namely 'image c', according to the login verification instruction;
obtaining the current accumulated click times of a user to be verified, namely 2;
at this time, the current accumulated click times 2 do not exceed a set click times threshold 4, and the current verification code image is decoded according to the click position of the user to be verified on the current verification code image to obtain the decoding result of the current verification code image; when the click position of the user to be verified on the current verification code image is the position of the block 3 of the verification code image I shown in the figure a, the two-dimensional code block corresponding to the position of the block 3 is a covered or replaced non-two-dimensional code image, at this time, the two-dimensional code block covered or replaced by the non-two-dimensional code image is subjected to recovery processing, the verification code image subjected to the recovery processing is decoded, and the figure d shown in the figure 5 is decoded;
when the decoding fails, increasing the current accumulated click times by 1; the verification code image graph d after recovery processing can be sent to a terminal, the terminal displays the verification code image graph d after recovery processing, and a user to be verified clicks the graph d;
receiving a login verification instruction of a user to be verified;
obtaining a current verification code image, namely 'image d', according to the login verification instruction;
obtaining the current accumulated click times of a user to be verified, namely 3;
at this time, the current accumulated click times 3 do not exceed a set click times threshold 4, and the current verification code image is decoded according to the click position of the user to be verified on the current verification code image to obtain the current decoding result of the verification code image; when the click position of the user to be verified on the current verification code image is the position of the block 8 of the verification code image I shown in the figure a, the two-dimensional code block corresponding to the position of the block 8 is a covered or replaced non-two-dimensional code image, at this time, the two-dimensional code block covered or replaced by the non-two-dimensional code image is subjected to recovery processing, the verification code image subjected to the recovery processing is decoded, and the figure e shown in the figure 5 is decoded;
and when the decoding is successful, determining that the user to be verified is a legal user.
When the method is applied to the terminal, the terminal performs the step of displaying each verification code image.
In another case, assume that the threshold value of the number of clicks is set to 1;
the server sends the first verification code image to a terminal held by a user to be verified, the terminal displays the first verification code image for the user to be verified to click, the first verification code image of the user to be verified is clicked, and a login verification instruction is triggered;
receiving a login verification instruction of a user A to be verified;
obtaining a current verification code image, namely 'image a', according to a login verification instruction;
obtaining the current accumulated click times of a user to be verified, namely 0;
at the moment, the current accumulated click times 0 do not exceed the set click times threshold 1, and the current verification code image is decoded according to the click position of the user to be verified on the current verification code image to obtain the decoding result of the current verification code image; when the click position of a user to be verified on the current verification code image is the position of a block 5 of a verification code image I shown in a figure a, a two-dimensional code block corresponding to the position of the block 5 is a covered or replaced non-two-dimensional code image, at this time, the two-dimensional code block covered or replaced by the non-two-dimensional code image is subjected to recovery processing, the verification code image subjected to the recovery processing is decoded, and then a figure b shown in a figure 5 is decoded;
when the decoding fails, increasing the current accumulated click times by 1; and can send the verification code image 'picture b' after recovery processing to the terminal, the terminal displays the verification code image 'picture b' after recovery processing, the user to be verified clicks the 'picture b',
receiving a login verification instruction of a user to be verified;
obtaining a current verification code image, namely 'image b', according to a login verification instruction;
obtaining the current accumulated click times of a user to be verified, namely 1;
at this time, the current accumulated click frequency 2 exceeds the set click frequency threshold 1, and the user to be verified is determined to be an illegal user.
Corresponding to the foregoing method embodiment, an embodiment of the present invention provides a login authentication device, and as shown in fig. 6, the login authentication device may include:
the receiving module 610 is configured to receive a login authentication instruction of a user to be authenticated;
a first obtaining module 620, configured to obtain a current verification code image according to the login verification instruction, where the verification code image includes a two-dimensional code image pre-divided into N two-dimensional code blocks, M two-dimensional code blocks of the N two-dimensional code blocks are covered or replaced by a preset non-two-dimensional code image, N and M are positive integers, and M is less than or equal to N;
a second obtaining module 630, configured to obtain a current accumulated number of clicks of the user to be authenticated;
the decoding module 640 is configured to, when the current accumulated click number does not exceed a set click number threshold, decode the current verification code image according to the click position of the user to be verified on the verification code image, so as to obtain a current decoding result of the verification code image;
a first determining module 650, configured to determine that the user to be authenticated is an illegal user when the decoding result is a failure and the obtained accumulated click times of the user to be authenticated exceeds the set click time threshold when the next login authentication instruction of the user to be authenticated is received.
In the embodiment of the present invention, the verification code image includes a two-dimensional code image pre-divided into N two-dimensional code blocks, and M two-dimensional code blocks are covered or replaced by a preset non-two-dimensional code image, so that a user to be verified needs to perform a click operation within a threshold number of clicks, so that the verification code image can be successfully decoded. And when the number of clicks does not exceed the set number of clicks threshold, the user to be verified fails to enable the verification code image to be successfully decoded, namely, the user to be verified is considered as an illegal user. The problems of automatic login, malicious multi-login and the like can be avoided to a certain extent, the accuracy of verification of the problems of automatic login, malicious multi-login and the like is improved, and the defense of automatic login and malicious multi-login is enhanced.
In one implementation, the apparatus further comprises:
the second determining module is used for determining the user to be verified as an illegal user when the current accumulated click times exceed the set click times threshold; or
And when the decoding result is successful, determining that the user to be verified is a legal user.
In one implementation, the second obtaining module 630 is specifically configured to
According to the login verification instruction, increasing the stored accumulated click times by 1, wherein the stored accumulated click times are as follows: receiving the accumulated click times of the user to be verified in the previous login verification instruction;
taking the stored accumulated click times after the increment of 1 as the current accumulated click times of the user to be verified; or the like, or, alternatively,
obtaining the stored accumulated click times as the current accumulated click times of the user to be verified;
the device further comprises:
a first increment module, configured to increment, by 1, the current accumulated click number when the decoding result is failure after the obtained and stored accumulated click number is used as the current accumulated click number of the user to be verified; and taking the accumulated click times after 1 increment as the accumulated click times of the user to be verified, which is obtained when the next login verification instruction of the user to be verified is received.
In one implementation, the apparatus further comprises:
and a second increment module, configured to increment, by 1, the accumulated click number by when the accumulated click number does not exceed the set click number threshold and the two-dimensional code block corresponding to the click position is determined to be a two-dimensional code block according to the click position after the accumulated click number of the user to be verified is obtained.
In one implementation, the decoding module 640 is specifically configured to
And according to the click position, when the two-dimensional code block corresponding to the click position in the current verification code image is determined to be a non-two-dimensional code image or covered by the non-two-dimensional code image, restoring the two-dimensional code block covered or replaced by the non-two-dimensional code image, and decoding the verification code image after restoration processing.
In one implementation, the apparatus further comprises:
and the replacing module is used for replacing the current verification code image with the verification code image obtained after the recovery processing is carried out on the two-dimensional code block covered or replaced by the non-two-dimensional code image, so as to be used as the current verification code image when the next login verification instruction of the user to be verified is received.
In one implementation, the apparatus further comprises:
the third obtaining module is used for obtaining a two-dimensional code image to be processed before the login verification instruction of the user to be verified is received;
the segmentation module is used for segmenting the two-dimensional code image to be processed to obtain N two-dimensional code blocks;
a selecting module, configured to randomly select M two-dimensional code blocks from the N two-dimensional code blocks;
the generation module is used for covering or replacing the M two-dimensional code blocks with P non-two-dimensional code images aiming at the selected M two-dimensional code blocks to generate the verification code image, wherein P is a positive integer not larger than M;
the receiving module is particularly used for
And receiving a login verification instruction sent by a user to be verified aiming at the verification code image.
In one implementation, the generating module includes:
a judging unit for judging whether the current filling operation frequency exceeds Z; wherein Z is equal to M minus 1; triggering a processing unit when judging that the current filling operation frequency does not exceed Z; when the current filling operation frequency is judged to exceed Z, triggering a first determining unit;
the processing unit is used for covering or replacing one uncovered or replaced two-dimensional code block in the M two-dimensional code blocks by using one non-two-dimensional code image in the P non-two-dimensional code images to obtain a current two-dimensional code image to be processed;
the first increasing unit is used for increasing the filling operation times by 1 to serve as the current filling operation times and trigger the judging unit;
the first determining unit is used for determining the current two-dimensional code image to be processed as the verification code image.
In one implementation, the generating module further includes:
the decoding unit is used for decoding the current two-dimensional code image to be processed before the filling operation times are increased by 1 as the current filling operation times; when the current two-dimensional code image to be processed fails to be decoded, triggering the first increment unit; when the current two-dimensional code image to be processed is successfully decoded, triggering a second increasing unit;
the second incremental unit is configured to, when the current to-be-processed two-dimensional code image is successfully decoded, increment the coding redundancy number by 1, and trigger the first incremental unit, where the coding redundancy number is used to set the threshold of the set click number.
In one implementation, the generating module further includes:
the obtaining unit is used for obtaining the decoding redundancy times when the verification code image is determined after the current two-dimensional code image to be processed is determined as the verification code image;
a calculating unit for calculating a difference between M and the obtained decoding redundancy number;
and the second determining unit is used for determining the sum of the difference and the preset fault-tolerant times as a set click time threshold, wherein the set click time threshold is not more than M.
The receiving module 610, the first obtaining module 620, the second obtaining module 630, the decoding module 640, and the first determining module 650 correspond to the user click recovery module shown in fig. 1A. The receiving module 610 corresponds to the receiving sub-module, the first obtaining module 620 corresponds to the first obtaining sub-module, the second obtaining module 630 and the decoding module 640 correspond to the second obtaining sub-module, and the first determining module 650 corresponds to the first determining sub-module.
The third obtaining module and the dividing module correspond to the dividing module, and the generating module corresponds to the filling module.
Corresponding to the above method embodiments, the embodiment of the present invention further provides an electronic device, as shown in fig. 7, including a processor 710, a communication interface 720, a memory 730, and a communication bus 740, where the processor 710, the communication interface 720, and the memory 730 communicate with each other through the communication bus 740,
a memory 730 for storing a computer program;
the processor 710, configured to execute the computer program stored in the memory 730 to implement any of the above login authentication methods provided in the embodiments of the present invention, may include the steps of:
receiving a login verification instruction of a user to be verified;
obtaining a current verification code image according to the login verification instruction, wherein the verification code image comprises a two-dimensional code image which is pre-divided into N two-dimensional code blocks, M two-dimensional code blocks in the N two-dimensional code blocks are covered or replaced by preset non-two-dimensional code images, N and M are positive integers, and M is smaller than or equal to N;
obtaining the current accumulated click times of the user to be verified, and decoding the current verification code image according to the click position of the user to be verified on the verification code image when the current accumulated click times does not exceed a set click times threshold value to obtain the current decoding result of the verification code image;
and when the decoding result is failure and the next login verification instruction of the user to be verified is received, and the obtained accumulated click times of the user to be verified exceed the set click times threshold value, determining that the user to be verified is an illegal user.
In the embodiment of the present invention, the verification code image includes a two-dimensional code image pre-divided into N two-dimensional code blocks, and M two-dimensional code blocks are covered or replaced by a preset non-two-dimensional code image, so that a user to be verified needs to perform a click operation within a threshold number of clicks, so that the verification code image can be successfully decoded. And when the number of clicks does not exceed the set number of clicks threshold, the user to be verified fails to enable the verification code image to be successfully decoded, namely, the user to be verified is considered as an illegal user. The problems of automatic login, malicious multi-login and the like can be avoided to a certain extent, the accuracy of verification of the problems of automatic login, malicious multi-login and the like is improved, and the defense of automatic login and malicious multi-login is enhanced.
Wherein, the electronic device may be: a terminal capable of providing functions of logging in a website and/or application software; the server may be connected to the terminal that can provide functions such as registering a website and/or application software.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also 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.
Corresponding to the foregoing method embodiment, an embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements any of the foregoing login authentication methods provided in the embodiment of the present invention, where the computer program includes:
receiving a login verification instruction of a user to be verified;
obtaining a current verification code image according to the login verification instruction, wherein the verification code image comprises a two-dimensional code image which is pre-divided into N two-dimensional code blocks, M two-dimensional code blocks in the N two-dimensional code blocks are covered or replaced by preset non-two-dimensional code images, N and M are positive integers, and M is smaller than or equal to N;
obtaining the current accumulated click times of the user to be verified, and decoding the current verification code image according to the click position of the user to be verified on the verification code image when the current accumulated click times does not exceed a set click times threshold value to obtain the current decoding result of the verification code image;
and when the decoding result is failure and the next login verification instruction of the user to be verified is received, and the obtained accumulated click times of the user to be verified exceed the set click times threshold value, determining that the user to be verified is an illegal user.
In the embodiment of the present invention, the verification code image includes a two-dimensional code image pre-divided into N two-dimensional code blocks, and M two-dimensional code blocks are covered or replaced by a preset non-two-dimensional code image, so that a user to be verified needs to perform a click operation within a threshold number of clicks, so that the verification code image can be successfully decoded. And when the number of clicks does not exceed the set number of clicks threshold, the user to be verified fails to enable the verification code image to be successfully decoded, namely, the user to be verified is considered as an illegal user. The problems of automatic login, malicious multi-login and the like can be avoided to a certain extent, the accuracy of verification of the problems of automatic login, malicious multi-login and the like is improved, and the defense of automatic login and malicious multi-login is enhanced.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (20)

1. A login authentication method, the method comprising:
receiving a login verification instruction of a user to be verified;
obtaining a current verification code image according to the login verification instruction, wherein the verification code image comprises a two-dimensional code image which is pre-divided into N two-dimensional code blocks, M two-dimensional code blocks in the N two-dimensional code blocks are covered or replaced by preset non-two-dimensional code images, N and M are positive integers, and M is smaller than or equal to N;
obtaining the current accumulated click times of the user to be verified, and decoding the current verification code image according to the click position of the user to be verified on the current verification code image when the current accumulated click times does not exceed a set click times threshold value to obtain the decoding result of the current verification code image;
when the decoding result is failure and the next login verification instruction of the user to be verified is received, and the obtained accumulated click times of the user to be verified exceed the set click times threshold value, determining that the user to be verified is an illegal user;
wherein, the step of decoding the current verification code image according to the click position of the user to be verified on the current verification code image comprises the following steps:
and according to the click position, when the two-dimensional code block corresponding to the click position in the current verification code image is determined to be a non-two-dimensional code image or covered by the non-two-dimensional code image, restoring the two-dimensional code block covered or replaced by the non-two-dimensional code image, and decoding the verification code image after restoration processing.
2. The method of claim 1, further comprising:
when the current accumulated click times exceed the set click times threshold, determining that the user to be verified is an illegal user; or
And when the decoding result is successful, determining that the user to be verified is a legal user.
3. The method of claim 1, wherein the step of obtaining the current cumulative number of clicks of the user to be authenticated comprises:
according to the login verification instruction, increasing the stored accumulated click times by 1, wherein the stored accumulated click times are as follows: receiving the accumulated click times determined when the previous login verification instruction of the user to be verified is received; taking the accumulated click times after 1 increment as the current accumulated click times of the user to be verified; or the like, or, alternatively,
obtaining the stored accumulated click times as the current accumulated click times of the user to be verified;
after the step of obtaining the stored cumulative clicks as the current cumulative clicks of the user to be authenticated, the method further includes:
when the decoding result is failure, increasing the current accumulated click times by 1;
and taking the accumulated click times after 1 increment as the accumulated click times of the user to be verified, which is obtained when the next login verification instruction of the user to be verified is received.
4. The method of claim 3, wherein after the step of obtaining the stored cumulative clicks as a current cumulative click for the user to be authenticated, the method further comprises:
and when the current accumulated click times do not exceed the set click times threshold and the two-dimensional code block corresponding to the click position is determined to be a two-dimensional code block according to the click position, incrementing the current accumulated click times by 1.
5. The method according to claim 1, wherein after the step of performing recovery processing on the two-dimensional code blocks covered or replaced by the non-two-dimensional code image, the method further comprises:
and replacing the current verification code image with the verification code image obtained after recovery processing to serve as the current verification code image when the next login verification instruction of the user to be verified is received.
6. The method according to any of claims 1-5, wherein prior to the step of receiving a login authentication instruction of a user to be authenticated, the method further comprises:
obtaining a two-dimensional code image to be processed;
segmenting the two-dimensional code image to be processed to obtain N two-dimensional code blocks;
randomly selecting M two-dimensional code blocks from the N two-dimensional code blocks;
for the selected M two-dimensional code blocks, covering or replacing the M two-dimensional code blocks with P non-two-dimensional code images to generate the verification code image, wherein P is a positive integer not greater than M;
the step of receiving the login authentication instruction of the user to be authenticated comprises the following steps:
and receiving a login verification instruction sent by a user to be verified aiming at the verification code image.
7. The method according to claim 6, wherein the step of generating the verification code image by covering or replacing the M two-dimensional code blocks with P non-two-dimensional code images for the selected M two-dimensional code blocks comprises:
judging whether the current filling operation frequency exceeds Z; wherein Z is equal to M minus 1;
when the current filling operation frequency does not exceed Z, covering or replacing one uncovered or replaced two-dimensional code block in the M two-dimensional code blocks by using one non-two-dimensional code image in the P non-two-dimensional code images to obtain a current two-dimensional code image to be processed;
the filling operation times are increased by 1 as the current filling operation times, and the step of judging whether the current filling operation times exceed the Z is returned;
and when the current filling operation frequency is judged to exceed Z, determining the current two-dimensional code image to be processed as the verification code image.
8. The method of claim 7, wherein before the step of incrementing the number of fill operations by 1 as the current number of fill operations, the method further comprises:
decoding the current two-dimensional code image to be processed;
when the decoding of the current two-dimensional code image to be processed fails, executing the step of increasing the filling operation times by 1 as the current filling operation times;
when the current to-be-processed two-dimensional code image is successfully decoded, the decoding redundancy times are increased by 1, and the filling operation times are increased by 1 as the current filling operation times, wherein the decoding redundancy times are used for setting the set click time threshold.
9. The method according to claim 8, wherein after the step of determining the current to-be-processed two-dimensional code image as the verification code image, the method further comprises:
obtaining the decoding redundancy times when the verification code image is determined;
calculating the difference between M and the obtained decoding redundancy times;
and determining the sum of the difference and the preset fault-tolerant times as a set click time threshold, wherein the set click time threshold is not more than M.
10. A login authentication apparatus, the apparatus comprising:
the receiving module is used for receiving a login verification instruction of a user to be verified;
a first obtaining module, configured to obtain a current verification code image according to the login verification instruction, where the verification code image includes a two-dimensional code image pre-divided into N two-dimensional code blocks, M two-dimensional code blocks of the N two-dimensional code blocks are covered or replaced by a preset non-two-dimensional code image, N and M are positive integers, and M is less than or equal to N;
the second obtaining module is used for obtaining the current accumulated click times of the user to be verified;
the decoding module is used for decoding the current verification code image according to the click position of the user to be verified on the current verification code image when the current accumulated click times do not exceed a set click times threshold value, so as to obtain the decoding result of the current verification code image;
the first determining module is used for determining that the user to be verified is an illegal user when the decoding result is failure and the obtained accumulated click times of the user to be verified exceed the set click times threshold when the next login verification instruction of the user to be verified is received;
the decoding module is specifically configured to: and according to the click position, when the two-dimensional code block corresponding to the click position in the current verification code image is determined to be a non-two-dimensional code image or covered by the non-two-dimensional code image, restoring the two-dimensional code block covered or replaced by the non-two-dimensional code image, and decoding the verification code image after restoration processing.
11. The apparatus of claim 10, further comprising:
the second determining module is used for determining the user to be verified as an illegal user when the current accumulated click times exceed the set click times threshold; or
And when the decoding result is successful, determining that the user to be verified is a legal user.
12. The apparatus according to claim 10, characterized in that said second obtaining means are in particular adapted to
According to the login verification instruction, increasing the stored accumulated click times by 1, wherein the stored accumulated click times are as follows: receiving the accumulated click times of the user to be verified in the previous login verification instruction;
taking the stored accumulated click times after the increment of 1 as the current accumulated click times of the user to be verified; or the like, or, alternatively,
obtaining the stored accumulated click times as the current accumulated click times of the user to be verified;
the device further comprises:
a first increment module, configured to increment, by 1, the current accumulated click number when the decoding result is failure after the obtained and stored accumulated click number is used as the current accumulated click number of the user to be verified; and taking the accumulated click times after 1 increment as the accumulated click times of the user to be verified, which is obtained when the next login verification instruction of the user to be verified is received.
13. The apparatus of claim 12, further comprising:
and a second increment module, configured to increment, by 1, the accumulated click number by when the accumulated click number does not exceed the set click number threshold and the two-dimensional code block corresponding to the click position is determined to be a two-dimensional code block according to the click position after the accumulated click number of the user to be verified is obtained.
14. The apparatus of claim 10, further comprising:
and the replacing module is used for replacing the current verification code image with the verification code image obtained after the recovery processing is carried out on the two-dimensional code block covered or replaced by the non-two-dimensional code image, so as to be used as the current verification code image when the next login verification instruction of the user to be verified is received.
15. The apparatus according to any one of claims 10-14, further comprising:
the third obtaining module is used for obtaining a two-dimensional code image to be processed before the login verification instruction of the user to be verified is received;
the segmentation module is used for segmenting the two-dimensional code image to be processed to obtain N two-dimensional code blocks;
a selecting module, configured to randomly select M two-dimensional code blocks from the N two-dimensional code blocks;
the generation module is used for covering or replacing the M two-dimensional code blocks with P non-two-dimensional code images aiming at the selected M two-dimensional code blocks to generate the verification code image, wherein P is a positive integer not larger than M;
the receiving module is particularly used for
And receiving a login verification instruction sent by a user to be verified aiming at the verification code image.
16. The apparatus of claim 15, wherein the generating module comprises:
a judging unit for judging whether the current filling operation frequency exceeds Z; wherein Z is equal to M minus 1; triggering a processing unit when judging that the current filling operation frequency does not exceed Z; when the current filling operation frequency is judged to exceed Z, triggering a first determining unit;
the processing unit is used for covering or replacing one uncovered or replaced two-dimensional code block in the M two-dimensional code blocks by using one non-two-dimensional code image in the P non-two-dimensional code images to obtain a current two-dimensional code image to be processed;
the first increasing unit is used for increasing the filling operation times by 1 to serve as the current filling operation times and trigger the judging unit;
the first determining unit is used for determining the current two-dimensional code image to be processed as the verification code image.
17. The apparatus of claim 16, wherein the generating module further comprises:
the decoding unit is used for decoding the current two-dimensional code image to be processed before the filling operation times are increased by 1 as the current filling operation times; when the current two-dimensional code image to be processed fails to be decoded, triggering the first increment unit; when the current two-dimensional code image to be processed is successfully decoded, triggering a second increasing unit;
the second incremental unit is configured to, when the current to-be-processed two-dimensional code image is successfully decoded, increment the coding redundancy number by 1, and trigger the first incremental unit, where the coding redundancy number is used to set the threshold of the set click number.
18. The apparatus of claim 17, wherein the generating module further comprises:
the obtaining unit is used for obtaining the decoding redundancy times when the verification code image is determined after the current two-dimensional code image to be processed is determined as the verification code image;
a calculating unit for calculating a difference between M and the obtained decoding redundancy number;
and the second determining unit is used for determining the sum of the difference and the preset fault-tolerant times as a set click time threshold, wherein the set click time threshold is not more than M.
19. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the steps of the login authentication method according to any one of claims 1 to 9 when executing the computer program stored in the memory.
20. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the login authentication method steps of any one of claims 1 to 9.
CN201810778164.5A 2018-07-16 2018-07-16 Login verification method and device and electronic equipment Active CN110730152B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810778164.5A CN110730152B (en) 2018-07-16 2018-07-16 Login verification method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810778164.5A CN110730152B (en) 2018-07-16 2018-07-16 Login verification method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN110730152A CN110730152A (en) 2020-01-24
CN110730152B true CN110730152B (en) 2021-11-26

Family

ID=69217333

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810778164.5A Active CN110730152B (en) 2018-07-16 2018-07-16 Login verification method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN110730152B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111639322B (en) * 2020-06-17 2023-09-29 中国银行股份有限公司 Application login method and device, electronic equipment and computer storage medium
CN113194104B (en) * 2021-06-30 2021-09-10 南京敏宇数行信息技术有限公司 Secure remote access system, method, computer equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101339666A (en) * 2008-08-12 2009-01-07 腾讯科技(深圳)有限公司 Picture identifying code creation method and device
CN103139204A (en) * 2012-12-19 2013-06-05 姚爱军 Network identifying code method and system
CN104702406A (en) * 2013-12-04 2015-06-10 腾讯科技(深圳)有限公司 Identity verification method and identity verification device
CN104852889A (en) * 2014-02-18 2015-08-19 腾讯科技(深圳)有限公司 Picture identifying code generation method and system, and verify method and client side, and server

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9280697B2 (en) * 2011-11-16 2016-03-08 Apple Inc. Authentication device including template validation and related methods
CN105095726B (en) * 2014-05-08 2018-05-11 阿里巴巴集团控股有限公司 Generate the method and device of identifying code

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101339666A (en) * 2008-08-12 2009-01-07 腾讯科技(深圳)有限公司 Picture identifying code creation method and device
CN103139204A (en) * 2012-12-19 2013-06-05 姚爱军 Network identifying code method and system
CN104702406A (en) * 2013-12-04 2015-06-10 腾讯科技(深圳)有限公司 Identity verification method and identity verification device
CN104852889A (en) * 2014-02-18 2015-08-19 腾讯科技(深圳)有限公司 Picture identifying code generation method and system, and verify method and client side, and server

Also Published As

Publication number Publication date
CN110730152A (en) 2020-01-24

Similar Documents

Publication Publication Date Title
CN109857592B (en) Data recovery control method, server and storage medium
US20160292411A1 (en) Verification method, apparatus and system
CN112235321B (en) Short message verification code anti-brushing method and device
CN109960957A (en) Incomplete two dimensional code and its generation, reparation and recognition methods, apparatus and system
CN104796428A (en) Dynamic verification method, client side, server and system
CN110730152B (en) Login verification method and device and electronic equipment
CN111126317B (en) Image processing method, device, server and storage medium
WO2021027150A1 (en) Server security detection method and apparatus, computer device, and storage medium
CN109145651B (en) Data processing method and device
CN103269384A (en) Rich client abnormality processing method, processing device and processing system
CN111259358A (en) Login method, login device, computer equipment and storage medium
CN113422687B (en) Verification method, verification server and verification system
CN115630663A (en) Two-dimensional code identification method and device and electronic equipment
CN109688109B (en) Verification method and device of verification code based on client information identification
CN110598421B (en) Two-dimensional code encryption method and device and two-dimensional code decryption method and device
CN112632564B (en) Threat assessment method and device
US10223568B2 (en) Barcode decoding method
CN111949952B (en) Method for processing verification code request and computer-readable storage medium
KR102194567B1 (en) Method and apparatus for barcode identification
CN114298714A (en) Account identity authentication method and device, electronic equipment and storage medium
CN112632504B (en) Webpage access method, device, system, computer equipment and storage medium
CN111143305B (en) Data storage method, device, equipment and medium based on distributed storage system
CN110516430B (en) Identity authentication method, server and client
CN108875349B (en) Verification code generation method and device based on pinyin
CN114679336B (en) Authentication method, authentication system, authentication device, and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant