Expand all

AuthPopup

Allows opening the login form without leaving the page.

The page opened in the popup should communicate success using the authSuccess.js script. If it doesn't, we also check for a login success when the user interacts with the parent window.

The constructor is not publicly accessible in MediaWiki. Use the instance exposed by the mediawiki.authenticationPopup module.

This library is not stable yet (as of May 2024). We're still testing which of the methods work from the technical side, and which methods are understandable for users. Some methods or the whole library may be removed in the future.

Unstable.

Constructor

new AuthPopup(config) #

Parameters:

Name Type Description
config Object
Properties:
Name Type Attributes Description
loginPopupUrl string

URL of the login form to be opened as a popup

loginFallbackUrl string optional

URL of a fallback login form to link to if the popup can't be opened. Defaults to loginPopupUrl if not provided.

checkLoggedIn AuthPopup~CheckLoggedIn

Async function to check for a login success.

message jQuery | string | function | null optional

Custom message to replace the contents of the backdrop message dialog, passed to OO.ui.MessageDialog

Source:

Methods

startIframe() → {Promise.<any>} #

Open the login form in an iframe in a modal message dialog.

In order for this to work, the wiki must be configured to allow the login page to be framed ($wgEditPageFrameOptions), which has security implications.

Add a button to provide an alternative method to log in, just in case.

Source:

Returns:

Resolved when the login succeeds with the value returned by the checkLoggedIn callback. Resolved with a falsy value if the user cancels the process. Rejected when an unexpected error stops the login process.

Type
Promise.<any>
Open the login form in an iframe in a modal message dialog.

startNewTabOrWindow() → {Promise.<any>} #

Open the login form in a new browser tab or window.

In the parent window, display a backdrop message dialog, to provide an alternative method to log in if the browser refuses to open the window, and to allow the user to restart the process if they lose track of the new tab or window.

This should only be called in response to a user-initiated event like 'click', otherwise the user's browser will always refuse to open the window.

Source:

Returns:

Resolved when the login succeeds with the value returned by the checkLoggedIn callback. Resolved with a falsy value if the user cancels the process. Rejected when an unexpected error stops the login process.

Type
Promise.<any>
Open the login form in a new browser tab or window.

startPopupWindow() → {Promise.<any>} #

Open the login form in a small browser popup window.

In the parent window, display a backdrop message dialog with the same dimensions, to provide an alternative method to log in if the browser refuses to open the window, and to allow the user to restart the process if they lose track of the popup window.

This should only be called in response to a user-initiated event like 'click', otherwise the user's browser will always refuse to open the window.

Source:

Returns:

Resolved when the login succeeds with the value returned by the checkLoggedIn callback. Resolved with a falsy value if the user cancels the process. Rejected when an unexpected error stops the login process.

Type
Promise.<any>
Open the login form in a small browser popup window.

Type Definitions

CheckLoggedIn() → {Promise.<any>} #

Async function to check for a login success.

Source:

Returns:

A promise resolved with a truthy value if the user is logged in and resolved with a falsy value if the user isn’t logged in.

Type
Promise.<any>
Async function to check for a login success.