show domains, fix date

This commit is contained in:
AJ ONeal 2018-08-05 08:11:54 +00:00
parent 6972112782
commit 09660b0731
2 changed files with 25 additions and 3 deletions

View File

@ -9,6 +9,17 @@
<button class="js-auth-submit" type="submit">Login</button> <button class="js-auth-submit" type="submit">Login</button>
</form> </form>
<div class="v-app">
<ol>
<li v-for="domain in domains">
{{ domain }}
</li>
</ol>
</div>
<!-- development version, includes helpful console warnings -->
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="assets/oauth3.org/oauth3.core.js"></script> <script src="assets/oauth3.org/oauth3.core.js"></script>
<script> <script>
(function () { (function () {
@ -48,8 +59,14 @@
// //
console.info('Secure PPID (aka subject):', session.token.sub); console.info('Secure PPID (aka subject):', session.token.sub);
function listStuff() { function listStuff(data) {
window.alert("TODO: show authorized devices, domains, and connectivity information"); //window.alert("TODO: show authorized devices, domains, and connectivity information");
var app6 = new Vue({
el: '.v-app',
data: {
domains: data.domains
}
});
} }
return oauth3.request({ return oauth3.request({
@ -77,6 +94,11 @@
console.info("Telebit Account:"); console.info("Telebit Account:");
console.log(resp.data); console.log(resp.data);
if (resp.data && resp.data.domains) {
listStuff(resp.data);
return;
}
if (1 === resp.data.accounts.length) { if (1 === resp.data.accounts.length) {
listStuff(resp); listStuff(resp);
} else if (0 === resp.data.accounts.length) { } else if (0 === resp.data.accounts.length) {

View File

@ -19,7 +19,7 @@ files.forEach(function (fname) {
email = fname.replace('\.' + data.domains.join('') + '\.data', ''); email = fname.replace('\.' + data.domains.join('') + '\.data', '');
mdata = JSON.parse(fs.readFileSync(path.join(basedir, email))); mdata = JSON.parse(fs.readFileSync(path.join(basedir, email)));
if (data.iat) { if (data.iat) {
iat = new Date(data.iat).toISOString(); iat = new Date(data.iat * 1000).toISOString();
} }
if (!emails[email]) { if (!emails[email]) {
emails[email] = { emails[email] = {