Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New auth server root template #1620

Open
wants to merge 2 commits into
base: auth-upgrade
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 47 additions & 18 deletions default-templates/server/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,45 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Welcome to Solid</title>
<link rel="stylesheet" href="/common/css/bootstrap.min.css">
<link rel="stylesheet" href="/common/css/solid.css">
</head>
<body>
<div class="container">
<div class="page-header">
<div class="pull-right">
<button id="register" type="button" class="btn btn-primary">Register</button>
<button id="login" type="button" class="hidden btn btn-default btn-success">Log in</button>
<button id="logout" type="button" class="hidden btn btn-danger">Log out</button>
</div>
<style>
#prototype {
margin : 2em;
padding : 1em;
}
#prototype input {
margin : 1em;
padding : 0.5em !important;
}
#loginStatusArea {
float:right;
clear:right;
margin-top:-5em;
}
</style>
<script>
document.addEventListener('DOMContentLoaded', async function() {
if (!UI.authn.currentUser()) await UI.authn.checkUser();
let user = UI.authn.currentUser();
if( user ) {
document.getElementById('prototype').style.display = "none";
var podRoot = user.uri.replace(/profile.*$/,'');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does make and assumption about the form of the webid, but if that assumption fails, its ok as it will default to showing the user rather than the pod, which will be fine.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, and also, since this is a change to NSS, not mashlib, the assumption should hold.

podRoot = UI.rdf.sym(podRoot)
panes.runDataBrowser(podRoot);
}
else {
document.getElementById('prototype').style.display = "block";
document.getElementById('loginStatusArea').appendChild(UI.authn.loginStatusBox(document, null, {}))

}
})
</script>
<link href="/mash.css" rel="stylesheet">
</head><body class="db-layout">

<div id="prototype" class="container">
<div class="page-header">
<h1>Welcome to the Solid Prototype</h1>
<div id="loginStatusArea" class="pull-right"></div>
</div>

<p class="lead">
Expand All @@ -27,11 +53,6 @@ <h1>Welcome to the Solid Prototype</h1>
If you have not already done so, please create an account.
</p>

<p class="lead hidden" id="loggedIn">
You are logged in as
<a href="#" id="profileLink"></a>.
</p>

<section>
{{#if serverLogo}}
<img src="{{serverLogo}}" />
Expand All @@ -49,7 +70,15 @@ <h2>Server info</h2>
</dl>
</section>
</div>
<script src="/common/js/solid-auth-client.bundle.js"></script>
<script src="/common/js/auth-buttons.js"></script>

<header class="db-layout__header header" id="PageHeader"></header>
<div class="TabulatorOutline db-layout__content" id="DummyUUID" role="main">
<table id="outline"></table>
<div id="GlobalDashboard"></div>
</div>
<footer class="db-layout__footer" id="PageFooter"></footer>

<script src="/mashlib.js"></script>

</body>
</html>