Files
cloudron-box/webadmin/src/login_callback.html
T

35 lines
968 B
HTML
Raw Normal View History

<html>
<head>
<title> Cloudron OAuth Callback </title>
<script>
'use strict';
var search = decodeURIComponent(window.location.search).slice(1).split('&').map(function (item) { return item.split('='); }).reduce(function (o, k) { o[k[0]] = k[1]; return o; }, {});
if (!search.token) {
console.error('No token found');
} else if (!search.state || !window.localStorage.oauth2State || search.state !== window.localStorage.oauth2State ) {
console.error('OAuth2 state error');
} else {
// the actual app picks up the access token from localStorage
localStorage.token = search.token;
// clear oauth2 state
delete window.localStorage.oauth2State;
2015-10-01 16:22:46 +02:00
var returnTo = window.localStorage.returnTo;
delete window.localStorage.returnTo;
if (returnTo) window.location.href = returnTo;
2015-10-01 16:11:39 +02:00
else window.location.href = '/';
}
</script>
</head>
<body>
</body>
</html>