Fix OAuth loading state (#24788)
Fix regression from https://github.com/go-gitea/gitea/pull/24740 where
the loading state was not showing because the `oauth-login-image` class
was removed. Replaced the Fomantic loader with a pure CSS loader and
cleaned up the HTML.
Diff:
https://github.com/go-gitea/gitea/pull/24788/files?diff=unified&w=1

Co-authored-by: Giteabot <teabot@gitea.io>
This commit is contained in:
parent
09ab64dfad
commit
1e1e8b5d43
3 changed files with 44 additions and 44 deletions
|
@ -1,24 +1,22 @@
|
|||
import $ from 'jquery';
|
||||
import {hideElem, showElem} from '../utils/dom.js';
|
||||
|
||||
export function initUserAuthOauth2() {
|
||||
const $oauth2LoginNav = $('#oauth2-login-navigator');
|
||||
if ($oauth2LoginNav.length === 0) return;
|
||||
const outer = document.getElementById('oauth2-login-navigator');
|
||||
if (!outer) return;
|
||||
const inner = document.getElementById('oauth2-login-navigator-inner');
|
||||
|
||||
$oauth2LoginNav.find('.oauth-login-image').on('click', () => {
|
||||
const oauthLoader = $('#oauth2-login-loader');
|
||||
const oauthNav = $('#oauth2-login-navigator');
|
||||
|
||||
hideElem(oauthNav);
|
||||
oauthLoader.removeClass('disabled');
|
||||
|
||||
setTimeout(() => {
|
||||
// recover previous content to let user try again
|
||||
// usually redirection will be performed before this action
|
||||
oauthLoader.addClass('disabled');
|
||||
showElem(oauthNav);
|
||||
}, 5000);
|
||||
});
|
||||
for (const link of outer.querySelectorAll('.oauth-login-link')) {
|
||||
link.addEventListener('click', () => {
|
||||
inner.classList.add('gt-invisible');
|
||||
outer.classList.add('is-loading');
|
||||
setTimeout(() => {
|
||||
// recover previous content to let user try again
|
||||
// usually redirection will be performed before this action
|
||||
outer.classList.remove('is-loading');
|
||||
inner.classList.remove('gt-invisible');
|
||||
}, 5000);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export function initUserAuthLinkAccountView() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue