File tree Expand file tree Collapse file tree 2 files changed +10
-8
lines changed
modules/oauth/src/main/ui Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,10 @@ final class AuthorizeUi(helpers: Helpers)(lightUserFallback: UserId => LightUser
2828 case None => strong(code(prompt.redirectUri.origin))
2929 ),
3030 prompt.redirectUri.insecure.option(flashMessage(" warning" )(" Does not use a secure connection" )),
31- postForm(action := s " ${routes.OAuth .authorizeApply}? ${ctx.req.rawQueryString}" )(
31+ postForm(
32+ id := " oauth-authorize" ,
33+ action := s " ${routes.OAuth .authorizeApply}? ${ctx.req.rawQueryString}"
34+ )(
3235 p(
3336 " Grant access to your " ,
3437 strong(otherUserRequested.fold(me.username)(_.name)),
@@ -55,7 +58,6 @@ final class AuthorizeUi(helpers: Helpers)(lightUserFallback: UserId => LightUser
5558 cls := s " button ${danger.so(" button-red ok-cancel-confirm text" )} disabled " ,
5659 dataIcon := danger.option(Icon .CautionTriangle ),
5760 disabled := true ,
58- id := " oauth-authorize" ,
5961 title := s " The website ${prompt.redirectUri.host | prompt.redirectUri.withoutQuery} will get access to your Lichess account. Continue? "
6062 )(" Authorize" )
6163 ),
Original file line number Diff line number Diff line change 11// ensure maximum browser compatibility here,
22// as the oauth page can be embedded in very dubious webviews
33
4- const el : HTMLElement = document . getElementById ( 'oauth-authorize' ) ! ;
4+ const form : HTMLElement = document . getElementById ( 'oauth-authorize' ) ! ;
5+ const submitBtn : HTMLButtonElement = form . querySelector ( 'button' ) ! ;
56
67setTimeout (
78 function ( ) {
8- el . removeAttribute ( 'disabled' ) ;
9- el . classList . remove ( 'disabled' ) ;
9+ submitBtn . removeAttribute ( 'disabled' ) ;
10+ submitBtn . classList . remove ( 'disabled' ) ;
1011 } ,
11- el . classList . contains ( 'button-red' ) ? 5000 : 2000 ,
12+ submitBtn . classList . contains ( 'button-red' ) ? 5000 : 2000 ,
1213) ;
1314
14- el . addEventListener ( 'click ' , function ( ) {
15+ form . addEventListener ( 'submit ' , function ( ) {
1516 setTimeout ( function ( ) {
1617 document . querySelector < HTMLDivElement > ( '.oauth form' ) ! . remove ( ) ;
1718 const oauthTop = document . querySelector < HTMLDivElement > ( '.oauth__top' ) ! ;
@@ -20,5 +21,4 @@ el.addEventListener('click', function () {
2021 successDiv . textContent = 'All set! You can now close this page and return to the app.' ;
2122 oauthTop . insertAdjacentElement ( 'afterend' , successDiv ) ;
2223 } , 500 ) ;
23- return true ;
2424} ) ;
You can’t perform that action at this time.
0 commit comments