User login state monitoring method and device, equipment, medium and product
By detecting the consistency of cookies in the browser window and user credential information in memory, the user login status is monitored in real time, and the problem of inability to monitor the user logout status in real time under multi-window operations is solved, and efficient and secure user login status management is achieved.
Patent Information
- Application Number
- CN202411766905.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-02-28
AI Technical Summary
In multiple browser window operation scenarios, the prior art cannot monitor and respond to the user's logout status in real time, resulting in misleading the user or posing a security risk.
By detecting whether the cookies and user credential information in memory are consistent between different windows of the browser, if they are inconsistent, lock the current window and prompt the user to refresh to ensure real-time monitoring of login status.
Real-time user login status monitoring in multi-window operation scenarios is realized, avoiding the risk of overreach and high performance consumption. The monitoring process is completed on the client and has high real-time response.
Smart Images

Figure CN119537157A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, and in particular, to a method, device, equipment, medium and product for monitoring user login status. Background Art
[0002] In today's large-scale systems or Internet projects, after users successfully log in to the system, they often encounter the situation of opening multiple browser windows for operation. In this regard, the user displayed on the page may not match the identity of the actual operation, which will mislead the user on the one hand and may cause the risk of unauthorized access on the other hand. To solve this problem, there are usually two existing technical solutions: 1. After the user logs in, a WebSocket (WebSocket is a network communication protocol designed to achieve full-duplex communication between the client and the server. Unlike the traditional HTTP request-response model, WebSocket allows a persistent connection to be established between the client and the server, so that data can be exchanged in real time between the two parties) long connection is established according to the user's credentials. When the server detects the user's logout operation, it pushes the user's logout message to the client through WebSocket. After receiving the message, the client clears the user information and returns to the login page. However, it has problems such as high performance consumption and inability to ensure real-time monitoring. 2. Carry user information when calling the interface, verify it on the server side and return a response to the client to achieve the purpose of monitoring the user's login status. The premise for this solution to take effect is that an operation of calling the interface must be triggered on the client, so real-time monitoring cannot be guaranteed. Summary of the invention
[0003] The embodiments of the present application provide a method, device, equipment, medium and product for monitoring the login status of a user to solve the technical problem in the prior art that, in a scenario where multiple windows of a browser are opened for operation, when a user logs out, the remaining windows cannot monitor and respond to the user's logout status in real time, causing misleading of the user or security risks.
[0004] In order to solve the above technical problems, this application is implemented as follows:
[0005] In a first aspect, an embodiment of the present application provides a method for monitoring a user's login status, the method comprising:
[0006] Opening a first window in a browser, wherein first user credential information is stored in a cookie of the browser and in a memory of the first window;
[0007] When detecting that a second window is opened in the browser, obtaining an operation performed by the user in the second window; and updating the first user credential information stored in the cookie to new user credential information according to the operation;
[0008] Detecting whether the user credential information stored in the memory of the current window with which the user is interacting is the same as the new user credential information stored in the cookie;
[0009] If they are the same, the login status of the user in the current window is kept unchanged;
[0010] If they are not the same, the current window is locked and a prompt message is issued, wherein the prompt message is used to prompt the user to refresh the current window.
[0011] Optionally, when it is detected that a second window is opened in the browser, obtaining an operation performed by the user in the second window; and updating the first user credential information stored in the cookie to new user credential information according to the operation includes at least one of the following:
[0012] If the second window has acquired and logged in the first login information corresponding to the first user credential information according to the first user credential information stored in the cookie, acquiring a user logout operation performed by the user in the second window; according to the user logout operation, updating the first user credential information stored in the cookie to a null value, and using the null value as the new user credential information;
[0013] If the second window has acquired and logged in the first login information corresponding to the first user credential information according to the first user credential information stored in the cookie, acquiring a user logout operation performed by the user in the second window; updating the first user credential information stored in the cookie to a null value according to the user logout operation; acquiring the second user login information entered by the user in the second window, sending the second user login information to the server, and receiving the second user credential information returned by the server; storing the second user credential information in the cookie of the browser as the new user credential information;
[0014] If the second window is opened within a preset time period after the first window is opened, obtain the second user login information entered by the user in the second window; send the second login information to the server, and receive the second user credential information returned by the server; store the second user credential information in the cookie as the new user credential information.
[0015] Optionally, when the new user credential information is a null value, after locking the current window and issuing a prompt message, the method further includes:
[0016] Receive the user's page refresh operation;
[0017] According to the page refresh operation, if the new user credential information stored in the cookie is read as a null value, the current page of the current window is returned to the login page.
[0018] Optionally, when the new user credential information is the second user credential information, after locking the current window and issuing a prompt message, the method further includes:
[0019] Receive the user's page refresh operation;
[0020] According to the page refresh operation, if the credential information of the second user is stored in the cookie, the login information of the second user is logged in in the current window according to the credential information of the second user;
[0021] Obtaining page access permissions corresponding to the second user login information;
[0022] The current page of the current window is updated according to the page access permission.
[0023] In a second aspect, an embodiment of the present application provides a device for monitoring a user login status, the device comprising:
[0024] An opening module, used for opening a first window in a browser, wherein the first user credential information is stored in a cookie of the browser and in a memory of the first window;
[0025] An execution module, configured to store the first user credential information in a cookie of the browser and in a memory of the first window;
[0026] When detecting that a second window is opened in the browser, obtaining an operation performed by the user in the second window; and updating the first user credential information stored in the cookie to new user credential information according to the operation;
[0027] Detecting whether the user credential information stored in the memory of the current window with which the user is interacting is the same as the new user credential information stored in the cookie;
[0028] If they are the same, the login status of the user in the current window is kept unchanged;
[0029] If they are not the same, the current window is locked and a prompt message is issued, wherein the prompt message is used to prompt the user to refresh the current window.
[0030] Optionally, the execution module is further configured to, if the second window has acquired and logged in first login information corresponding to the first user credential information according to the first user credential information stored in the cookie, acquire a user logout operation performed by the user in the second window; according to the user logout operation, update the first user credential information stored in the cookie to a null value, and use the null value as the new user credential information;
[0031] If the second window has acquired and logged in the first login information corresponding to the first user credential information according to the first user credential information stored in the cookie, acquiring a user logout operation performed by the user in the second window; updating the first user credential information stored in the cookie to a null value according to the user logout operation; acquiring the second user login information entered by the user in the second window, sending the second user login information to the server, and receiving the second user credential information returned by the server; storing the second user credential information in the cookie of the browser as the new user credential information;
[0032] If the second window is opened within a preset time period after the first window is opened, obtain the second user login information entered by the user in the second window; send the second login information to the server, and receive the second user credential information returned by the server; store the second user credential information in the cookie as the new user credential information.
[0033] Optionally, the execution module is also used to receive a page refresh operation from the user after locking the current window and issuing a prompt message when the new user credential information is a null value; according to the page refresh operation, if the new user credential information stored in the cookie is read as a null value, the current page of the current window is returned to the login page.
[0034] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor, a memory, and a program stored in the memory and executable on the processor, wherein when the program is executed by the processor, the steps of a method for monitoring user login status as described in the first aspect are implemented.
[0035] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of a method for monitoring user login status as described in the first aspect are implemented.
[0036] In a fifth aspect, an embodiment of the present application provides a computer program product, comprising computer instructions, which, when executed by a processor, implement the steps of a method for monitoring user login status as described in the first aspect.
[0037] In the embodiment of the present application, the characteristic of sharing cookies but not memory between different windows of the browser is utilized to detect whether the user credential information stored in the memory of the current window that is interacting with the user is the same as the new user credential information stored in the cookie; if they are the same, it indicates that the user login status is valid; otherwise, it indicates that the user login status is invalid. Therefore, while ensuring the legitimacy of the user's operation and avoiding the risk of unauthorized access, there is no need to establish a WebSocket connection, and the performance consumption is low; the monitoring process is completed on the client side, without the need to interact with the server, and the response is highly real-time; and the monitoring scenario coverage is comprehensive. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present application. Also, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0039] Figure 1 A flowchart of a method for monitoring user login status provided in an embodiment of the present application;
[0040] Figure 2 A flowchart of a method for monitoring user login status provided in an embodiment of the present application;
[0041] Figure 3 A structural block diagram of a user login status monitoring device provided in an embodiment of the present application;
[0042] Figure 4 A structural block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0043] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0044] Figure 1 A method for monitoring user login status according to an embodiment of the present application is shown, such as Figure 1 As shown, the method includes:
[0045] Step S101: Open a first window in a browser; wherein the first user credential information is stored in the cookie of the browser and in the memory of the first window;
[0046] Step S102: when it is detected that the second window is opened in the browser, obtain the operation performed by the user in the second window; and update the first user credential information stored in the cookie to new user credential information according to the operation;
[0047] Step S103, detecting whether the user credential information stored in the memory of the current window that is interacting with the user is the same as the new user credential information stored in the cookie; if they are the same, executing step S104; if they are different, executing step S105;
[0048] Step S104: Keep the login status of the user in the current window unchanged;
[0049] Step S105, locking the current window and issuing a prompt message;
[0050] The prompt information is used to prompt the user to refresh the current window.
[0051] It should be noted that, in a possible implementation, step S102, when detecting that a second window is opened in the browser, obtaining an operation performed by the user in the second window; and updating the first user credential information stored in the cookie to new user credential information according to the operation, includes at least one of the following: if the second window has obtained and logged in the first login information corresponding to the first user credential information according to the first user credential information stored in the cookie, obtaining a user logout operation performed by the user in the second window; according to the user logout operation, updating the first user credential information stored in the cookie to a null value, and using the null value as the new user credential information; if the second window has obtained and logged in the first login information corresponding to the first user credential information according to the first user credential information stored in the cookie, The first login information corresponding to the credential information is used to obtain the user logout operation performed by the user in the second window; according to the user logout operation, the first user credential information stored in the cookie is updated to a null value; the second user login information entered by the user in the second window is obtained, the second user login information is sent to the server, and the second user credential information returned by the server is received; the second user credential information is stored in the browser cookie as new user credential information; if the second window is opened within a preset time period after the first window is opened, the second user login information entered by the user in the second window is obtained; the second login information is sent to the server, and the second user credential information returned by the server is received; the second user credential information is stored in the cookie as new user credential information. Thus, three situations are distinguished, namely, in the second window, the first user is logged out first, and then the second user is logged in; in the second window, the first user is logged out, and in the second window, the second user is directly logged in, and the monitoring scenarios are fully covered.
[0052] It should be noted that, in step S103, the current window that is interacting with the user may be the first window, the second window, or a newly opened window in addition to the first window and the second window.
[0053] In a possible implementation, when the new user credential information is null, after locking the current window and issuing a prompt message in step S105, the method further includes: receiving a page refresh operation from the user; according to the page refresh operation, if the new user credential information stored in the cookie is null, returning the current page of the current window to the login page. When the new user credential information is the second user credential information, after locking the current window and issuing a prompt message in step S105, the method further includes: receiving a page refresh operation from the user; according to the page refresh operation, if the second user credential information is stored in the cookie, logging in the second user login information in the current window according to the second user credential information; obtaining the page access rights corresponding to the second user login information; and updating the current page of the current window according to the page access rights.
[0054] It should be noted that the method provided in the embodiment of the present application monitors the activity status of the browser window, and when the browser window is focused, compares the user credentials in the browser cookie with the user credentials in the current window memory to monitor the user login status in real time (specifically, a browser window focus event or mouseover event monitor can be added. When the event is triggered, the user credentials in the browser cookie are compared with the user credentials stored in the memory of the current window to see if they are the same, so as to achieve the purpose of monitoring the user login status). Therefore, after the user logs in, there is no need to interact with the server side, and the monitoring process is completed on the client side, with low performance consumption and comprehensive monitoring scenario coverage.
[0055] Among them, "focus event" usually refers to events related to input focus in computer programming and user interface design. In web development and graphical user interfaces, focus events are usually used to handle user interactions with input elements (such as text boxes, buttons, etc.). Here, only the window that the user is interacting with is monitored.
[0056] The "mouseover event" is a commonly used mouse event, mainly used in web page development. It refers to an event triggered when the mouse pointer moves over an element (such as a button, image, link, etc.).
[0057] The overall process can be referred to Figure 2 , specifically:
[0058] 1. Start by opening the browser window and entering the project login page, and perform the login operation to log in as a user. After a successful login, the server returns the user credentials to the client, and the client stores the user credentials in the browser cookie and in the memory of the current window at the same time.
[0059] 2. Add a browser window focus event listener, which is a necessary operation after the user logs in. It mainly uses the feature that different browser windows share cookies but do not share memory. When the window focus event is triggered, the user credentials stored in the cookie and memory are compared. If they are the same, it indicates that the user login status is valid; otherwise, it indicates that the user login status is invalid. A pop-up window will then be displayed to lock the window, and a user-friendly prompt will be given to guide the user to refresh the browser window.
[0060] 3. The user's operation scenarios in the actual use of the project can be classified into three scenarios. These three scenarios are described below. The two common operations of user credential storage and focus event monitoring in steps 1 and 2 above will not be mentioned in the following description.
[0061] Scenario 1:
[0062] (1) Open browser window 1, enter the project address and log in, log in as userA;
[0063] (2) Open browser window 2, enter the project address and enter. Since cookies can be shared between different browser windows, window 2 can detect that the user credentials already exist in the cookie, and then obtain the user information userA based on the user credentials;
[0064] (3) UserA logs out in window 2. After userA logs out, the page returns to the login page and the user credentials in the cookie are cleared.
[0065] (4) Go back to window 1, trigger the focus event, and compare the user credentials in the browser cookie with the user credentials in the memory of window 1. The user credentials in the cookie are now null, while the user credentials in the memory corresponding to window 1 have not changed. They are still the user credentials returned by the server after userA logged in. Therefore, the user credentials comparison result is inconsistent.
[0066] (5) A pop-up window is displayed to lock window 1, prohibiting the user from performing any further operations on the current page and guiding the user to refresh the current window;
[0067] (6) After the refresh operation is performed on window 1, it is detected that there is no user credential in the cookie and the page returns to the login page.
[0068] Scenario 2 (same as the first three steps of Scenario 1):
[0069] (1) Open browser window 1, enter the project address and log in, log in as userA;
[0070] (2) Open browser window 2, enter the project address and enter. Since cookies can be shared between different browser windows, window 2 can detect that the user credentials already exist in the cookie, and then obtain the user information userA based on the user credentials;
[0071] (3) UserA logs out in window 2. After userA logs out, the page returns to the login page and the user credentials in the cookie are cleared.
[0072] (4) User B logs in to window 2. After successful login, the user credential value in the cookie is set to user B's user credential;
[0073] (5) Go back to window 1, trigger the focus event, and compare the user credentials in the browser cookie with the user credentials in the memory of window 1. The user credentials in the cookie are now the user credentials of userB, while the user credentials in the memory corresponding to window 1 have not changed. They are still the user credentials returned by the server after userA logged in. Therefore, the user credentials comparison result is inconsistent.
[0074] (6) A pop-up window locks window 1, prohibiting the user from performing any further operations on the current page and guiding the user to refresh the current window;
[0075] (7) After the refresh operation is performed on window 1, it is detected that there is a user credential in the cookie. The user information of userB is obtained based on the user credential, and the corresponding action is performed based on the user rights of userB (if userB does not have the right to view the current page, it jumps to the default page that it has the right to view; if userB has the right to view the current page, it determines whether the current page needs to be partially updated, such as showing and hiding some operation buttons, etc.).
[0076] Scenario 3:
[0077] (1) Open two browser windows at the same time, Window 1 and Window 2, and enter the project login page respectively;
[0078] (2) Perform a login operation in window 1, log in as userA, and after successful login, set the user credentials in the cookie to userA's user credentials;
[0079] (3) Perform a login operation in window 2, log in as user B, and after successful login, reset the user credentials in the cookie to user B's user credentials;
[0080] (4) Go back to window 1, trigger the focus event, and compare the user credentials in the browser cookie with the user credentials in the memory of window 1. The user credentials in the cookie are now the user credentials of userB, while the user credentials in the memory corresponding to window 1 have not changed. They are still the user credentials returned by the server after userA logged in. Therefore, the user credentials comparison result is inconsistent.
[0081] (5) A pop-up window is displayed to lock window 1, prohibiting the user from performing any further operations on the current page and guiding the user to refresh the current window;
[0082] (6) After the refresh operation is performed on window 1, it is detected that there is a user credential in the cookie. The user information of userB is obtained based on the user credential, and the corresponding action is performed based on the user rights of userB (if userB does not have the right to view the current page, it jumps to the default page that it has the right to view; if userB has the right to view the current page, it determines whether the current page needs to be partially updated, such as showing and hiding some operation buttons, etc.).
[0083] It should be noted that the above summary describes three operation scenarios that may be encountered between two different windows of the same browser. By analogy, by opening three, four or more browser windows, the purpose of real-time monitoring of the user login status can be achieved according to the method provided in the embodiment of the present application.
[0084] Therefore, the method provided in the embodiment of the present application not only ensures the legitimacy of the user's operation and avoids the risk of unauthorized access, but also has the following technical effects: there is no need to establish a WebSocket connection, and the performance consumption is low; the monitoring process is completed on the client side, and there is no need to interact with the server, and the response is highly real-time; and the monitoring scenarios are fully covered.
[0085] Figure 3 A user login status monitoring device provided according to an embodiment of the present application is shown, such as Figure 3 As shown, the device 30 includes:
[0086] An opening module 301 is used to open a first window in a browser, and first user credential information is stored in a cookie of the browser and in a memory of the first window;
[0087] An execution module 302 is used to store the first user credential information in a cookie of the browser and in a memory of the first window;
[0088] When detecting that a second window is opened in the browser, obtaining an operation performed by the user in the second window; and updating the first user credential information stored in the cookie to new user credential information according to the operation;
[0089] Check whether the user credential information stored in the memory of the current window with which the user is interacting is the same as the new user credential information stored in the cookie;
[0090] If they are the same, the user's login status in the current window remains unchanged;
[0091] If they are not the same, the current window is locked and a prompt message is issued, wherein the prompt message is used to prompt the user to refresh the current window.
[0092] In a possible implementation, the execution module 302 is further used to obtain a user logout operation performed by the user in the second window if the second window has obtained and logged in the first login information corresponding to the first user credential information according to the first user credential information stored in the cookie; update the first user credential information stored in the cookie to a null value according to the user logout operation, and use the null value as the new user credential information;
[0093] If the second window has obtained and logged in the first login information corresponding to the first user credential information according to the first user credential information stored in the cookie, obtain the user logout operation performed by the user in the second window; update the first user credential information stored in the cookie to a null value according to the user logout operation; obtain the second user login information entered by the user in the second window, send the second user login information to the server, and receive the second user credential information returned by the server; store the second user credential information in the browser cookie as new user credential information;
[0094] If the second window is opened within a preset time period after the first window is opened, obtain the second user login information entered by the user in the second window; send the second login information to the server, and receive the second user credential information returned by the server; store the second user credential information in a cookie as new user credential information.
[0095] In one possible implementation, the execution module 302 is also used to receive a page refresh operation from the user after locking the current window and issuing a prompt message when the new user credential information is a null value; according to the page refresh operation, if the new user credential information stored in the cookie is a null value, the current page of the current window is returned to the login page.
[0096] In one possible implementation, the execution module 302 is also used to receive a page refresh operation from the user after locking the current window and issuing a prompt message when the new user credential information is the second user credential information; based on the page refresh operation, if the second user credential information is stored in the cookie, log in the second user login information in the current window based on the second user credential information; obtain the page access rights corresponding to the second user login information; and update the current page of the current window based on the page access rights.
[0097] Therefore, the device provided in the embodiment of the present application not only ensures the legitimacy of the user's operations and avoids the risk of unauthorized access, but also has the following technical effects: there is no need to establish a WebSocket connection, and the performance consumption is low; the monitoring process is completed on the client side, and there is no need to interact with the server, and the response is highly real-time; and the monitoring scenarios are fully covered.
[0098] The present application embodiment provides an electronic device 40, such as Figure 4 As shown, the electronic device 40 includes: a processor 401, a memory 402, and a program stored in the memory 402 and executable on the processor 401. When the program is executed by the processor 401, the steps of the method for monitoring the user login status shown in the above embodiment are implemented.
[0099] The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the method for monitoring the user login status shown in the above embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0100] An embodiment of the present application also provides a computer program product, including computer instructions, which, when executed by a processor, implement the steps of the user login status monitoring method shown in the above embodiment and can achieve the same technical effect. To avoid repetition, they are not repeated here.
[0101] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0102] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0103] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A method for monitoring user login status, characterized in that: The method comprises: Opening a first window in a browser, wherein first user credential information is stored in a cookie of the browser and in a memory of the first window; When detecting that a second window is opened in the browser, obtaining an operation performed by the user in the second window; and updating the first user credential information stored in the cookie to new user credential information according to the operation; Detecting whether the user credential information stored in the memory of the current window with which the user is interacting is the same as the new user credential information stored in the cookie; If they are the same, the login status of the user in the current window is kept unchanged; If they are not the same, the current window is locked and a prompt message is issued, wherein the prompt message is used to prompt the user to refresh the current window.
2. The method according to claim 1, characterized in that When detecting that a second window is opened in the browser, obtaining an operation performed by the user in the second window; and updating the first user credential information stored in the cookie to new user credential information according to the operation includes at least one of the following: If the second window has acquired and logged in the first login information corresponding to the first user credential information according to the first user credential information stored in the cookie, acquiring a user logout operation performed by the user in the second window; according to the user logout operation, updating the first user credential information stored in the cookie to a null value, and using the null value as the new user credential information; If the second window has acquired and logged in the first login information corresponding to the first user credential information according to the first user credential information stored in the cookie, acquiring a user logout operation performed by the user in the second window; updating the first user credential information stored in the cookie to a null value according to the user logout operation; acquiring the second user login information entered by the user in the second window, sending the second user login information to the server, and receiving the second user credential information returned by the server; storing the second user credential information in the cookie of the browser as the new user credential information; If the second window is opened within a preset time period after the first window is opened, obtaining second user login information input by the user in the second window; The second login information is sent to the server, and the second user credential information returned by the server is received; the second user credential information is stored in the cookie as the new user credential information.
3. The method according to claim 2, characterized in that When the new user credential information is a null value, after locking the current window and issuing a prompt message, the method further includes: Receive the user's page refresh operation; According to the page refresh operation, if the new user credential information stored in the cookie is read as a null value, the current page of the current window is returned to the login page.
4. The method according to claim 2, characterized in that: In a case where the new user credential information is the second user credential information, after locking the current window and issuing a prompt message, the method further includes: Receive the user's page refresh operation; According to the page refresh operation, if the credential information of the second user is stored in the cookie, the login information of the second user is logged in in the current window according to the credential information of the second user; Obtaining page access permissions corresponding to the second user login information; The current page of the current window is updated according to the page access permission.
5. A device for monitoring user login status, characterized in that: The device comprises: An opening module, used for opening a first window in a browser, wherein the first user credential information is stored in a cookie of the browser and in a memory of the first window; An execution module, configured to store the first user credential information in a cookie of the browser and in a memory of the first window; When detecting that a second window is opened in the browser, obtaining an operation performed by the user in the second window; and updating the first user credential information stored in the cookie to new user credential information according to the operation; Detecting whether the user credential information stored in the memory of the current window with which the user is interacting is the same as the new user credential information stored in the cookie; If they are the same, the login status of the user in the current window is kept unchanged; If they are not the same, the current window is locked and a prompt message is issued, wherein the prompt message is used to prompt the user to refresh the current window.
6. The device according to claim 5, characterized in that The execution module is further configured to, if the second window has acquired and logged in the first login information corresponding to the first user credential information according to the first user credential information stored in the cookie, acquire a user logout operation performed by the user in the second window; according to the user logout operation, update the first user credential information stored in the cookie to a null value, and use the null value as the new user credential information; If the second window has acquired and logged in the first login information corresponding to the first user credential information according to the first user credential information stored in the cookie, acquiring a user logout operation performed by the user in the second window; updating the first user credential information stored in the cookie to a null value according to the user logout operation; acquiring the second user login information entered by the user in the second window, sending the second user login information to the server, and receiving the second user credential information returned by the server; storing the second user credential information in the cookie of the browser as the new user credential information; If the second window is opened within a preset time period after the first window is opened, obtaining second user login information input by the user in the second window; The second login information is sent to the server, and the second user credential information returned by the server is received; the second user credential information is stored in the cookie as the new user credential information.
7. The device according to claim 6, characterized in that The execution module is also used to receive a page refresh operation from the user after locking the current window and issuing a prompt message when the new user credential information is a null value; according to the page refresh operation, if the new user credential information stored in the cookie is read as a null value, return the current page of the current window to the login page.
8. An electronic device, characterized in that: include: A processor, a memory, and a program stored in the memory and executable on the processor, wherein when the program is executed by the processor, the steps of the method for monitoring the user login status as described in any one of claims 1 to 4 are implemented.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for monitoring the user login status according to any one of claims 1 to 4 are implemented.
10. A computer program product, characterized in that It comprises computer instructions, which, when executed by a processor, implement the steps of the method for monitoring the user login status as described in any one of claims 1 to 4.