File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55 < meta charset ='UTF-8 '>
66 < title > solid-ui UI.widgets.header examples page</ title >
77 < script type ="text/javascript " src ="../../lib/webpack-bundle.js "> </ script >
8- < script src ="https://solid.github.io/solid-auth-client/dist/solid-auth-client.bundle .js "> </ script >
8+ < script type =" text/javascript " src ="../../lib/authn/authn .js "> </ script >
99 < script >
1010 const $ = document . querySelector . bind ( document )
1111 function showSource ( widgetName ) {
1717 . replace ( / ' / g, "'" )
1818 }
1919 </ script >
20- < style >
21- .loginButton {
22- border-radius : 0.2em ;
23- margin : 1em ;
24- font-size : 85% ;
25- background-color : # fff ;
26- border-style : .01em solid # 7C4DFF ;
27- color : # 7C4DFF ;
28- }
29-
30- .loginButton : hover {
31- background-color : # 7C4DFF ;
32- color : # fff ;
33- }
34- </ style >
3520</ head >
3621
3722< body >
3823
3924 < h2 id ="header "> < a href ="#header "> Header</ a >
40- < button class ="loginButton " onclick ="login('https://solidcommunity.net') "> Login</ button >
25+ < div id ="webId "> </ div >
26+ < div id ="loginBanner "> </ div >
4127 < script >
42- async function login ( idp ) {
43- const session = await solid . auth . currentSession ( ) ;
44- if ( ! session )
45- await solid . auth . login ( idp ) ;
28+ loginBanner . appendChild ( authn . loginStatusBox ( document , null , { } ) ) ;
29+
30+ async function finishLogin ( ) {
31+ await authn . authSession . handleIncomingRedirect ( ) ;
32+ const session = authn . authSession ;
33+ if ( session . info . isLoggedIn ) {
34+ // Update the page with the status.
35+ webId . innerHTML = "Logged in as: " + authn . currentUser ( ) . uri ;
36+ } else {
37+ webId . innerHTML = "" ;
38+ }
4639 }
40+
41+ finishLogin ( ) ;
4742 </ script >
4843 </ h2 >
4944 < p > This example demonstrates how to use the header component. The header has a different view depending
You can’t perform that action at this time.
0 commit comments