chatr/ChatrServer/wwwroot/device-qr/index.html

76 lines
2.6 KiB
HTML
Raw Permalink Normal View History

2022-08-24 11:34:56 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Chatr</title>
<link rel="stylesheet" href="./css/styles.css">
<link rel="stylesheet" href="./css/material.min.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="manifest" href="./site.webmanifest">
<link rel="icon" type="image/x-icon" href="./favicon.ico">
</head>
<body>
<!-- Always shows a header, even in smaller screens. -->
<div class="mdl-layout mdl-js-layout mdl-layout--fixed-header">
<header class="mdl-layout__header">
<div class="mdl-layout__header-row">
<!-- Title -->
<span class="mdl-layout-title">Chatr</span>
<!-- Add spacer, to align navigation to the right -->
<div class="mdl-layout-spacer"></div>
<!-- Navigation. We hide it in small screens. -->
<nav class="mdl-navigation mdl-layout--large-screen-only">
<a class="mdl-navigation__link" href="{{ url }}">{{ name }}</a>
</nav>
</div>
</header>
<div class="mdl-layout__drawer">
<span class="mdl-layout-title">Chatr</span>
<nav class="mdl-navigation">
<a class="mdl-navigation__link" href="{{ url }}">{{ name }}</a>
<a class="mdl-navigation__link" href="./">Home</a>
{{ if loggedin }}
<a class="mdl-navigation__link" href="./api/logout">Logout</a>
{{ end }}
</nav>
</div>
<main class="mdl-layout__content">
<div class="page-content">
<div class="center-screen2">
<h1>Login Using QR Code</h1>
{{ if loggedin }}
<p>Your password won't be shared with app, cause we don't remember it</p>
<div id="qrcode"></div>
<br>
{{ else }}
<p>Please Login <a href="./login">Login</a> Or <a href="./signup">Sign Up</a></p>
{{ end }}
</div>
</div>
</main>
</div>
<script src="./js/material.min.js"></script>
{{ if loggedin }}
<script src="./js/qrcode.min.js"></script>
<script>
fetch(`./api/new-ota.txt${window.location.search}`).then(e=>e.text()).then(e=>{
var qrcode = new QRCode(document.getElementById("qrcode"), {
width : 256,
height : 256,
text: window.location.href.replace('/device-qr',`/onetimeauth?key=${e}`),
});
});
</script>
{{ end }}
</body>
</html>