|
Experimental library that can display the login form in a small
browser popup window, a new browser tab or window, or an iframe in
a modal message dialog. We're still testing which of these methods
work from the technical side, and which are understandable for users.
Some methods or the whole library may be removed in the future.
Usage:
const authPopup = require( 'mediawiki.authenticationPopup' );
authPopup.startPopupWindow()
// or: authPopup.startNewTabOrWindow()
// or: authPopup.startIframe()
.then( function ( userinfo ) {
if ( userinfo ) {
// Logged in
} else {
// Cancelled by the user
}
}, function ( error ) {
// Unexpected error stopped the login process
} );
Or in future JS:
const userinfo = await authPopup.startPopupWindow(); // etc.
if ( userinfo ) {
// Logged in
} else {
// Cancelled by the user
}
In all three methods, the popup opens the login form with
&display=popup and with &returnto pointing to an unlisted special
page that communicates with the module on the parent page.
Once the library is stable, the AuthPopup component may be separated
from MediaWiki and released as its own package, to be used by tools
to open MediaWiki OAuth workflows in a similar way.
Bug: T364939
Change-Id: I08d9c799b8f79ebab2bcf4fcf330ee8eb995582e
|