Fix load flash

Signed-off-by: James Ketrenos <james_git@ketrenos.com>
This commit is contained in:
James Ketr 2018-09-29 17:11:59 -07:00
parent 1ef41c355b
commit b46c505b77
2 changed files with 34 additions and 15 deletions

View File

@ -282,7 +282,8 @@
<paper-tab tab="memories"><paper-icon-button icon="today"></paper-icon-button></paper-tab>
<paper-tab tab="albums"><paper-icon-button icon="folder"></paper-icon-button></paper-tab>
</paper-tabs>
<iron-pages id="pages" attr-for-selected="id" selected="[[mode]]" fallback-selection="memories">
<iron-pages id="pages" attr-for-selected="id" selected="[[mode]]" fallback-selection="loading">
<div id="loading"></div>
<div id="time"><div>... time slider ...</div></div>
<div id="memories" class="flex layout vertical center">
<div class="memory-buttons layout self-stretch horizontal around-justified">
@ -319,10 +320,11 @@
<app-header-layout>
<app-header reveals slot="header">
<div id="header" class="layout horizontal center">
<paper-icon-button icon="search" on-tap="drawerToggle"></paper-icon-button>
<paper-icon-button hidden$="[[!user]]" icon="search" on-tap="drawerToggle"></paper-icon-button>
<iron-pages class="flex" attr-for-selected="mode" selected="[[mode]]">
<div mode="login"><div>You are not logged in.</div></div>
<div mode="albums" id="breadcrumb" class="horizontal layout center">
<div id="loading"></div>
<div mode="login"><div>You are not logged in.</div></div>
<div mode="albums" id="breadcrumb" class="horizontal layout center">
<template is="dom-repeat" items="[[breadcrumb(path)]]">
<div tabindex="0" on-tap="loadPath">[[item.name]] /</div>
</template>
@ -340,31 +342,35 @@
</div>
</div>
</app-header>
<div>
<div hidden$="[[!user]]">
<iron-pages attr-for-selected="id" selected="[[mode]]" fallback-selection="content">
<div id="loading" class="layout vertical center">
<paper-spinner active$="[[loading]]" class="thin"></paper-spinner>
<div>~ Loading ~</div>
</div>
<div id="content">
<div id="thumbnails" class="layout horizontal wrap"></div>
<div id="bottom" class="layout vertical center">
<paper-spinner hidden$="[[!loading]]" active$="[[loading]]" class="thin"></paper-spinner>
<div hidden$="[[loading]]">~ the end ~</div>
</div>
</div>
<div id="login" hidden$="[[user]]" class="layout horizontal center">
<div id="login" class="layout horizontal center">
<div class="flex layout vertical">
<div id="instructions">
<p><b>ketrenos.com</b> is a personal website for my family and friends.</p>
<p>If you already have an email account on this domain, you can login to the photo viewer
using your normal @ketrenos.com account name, and password.</p>
</p>If you are a friend or family member (immediate, or extended)
<a on-tap="requestAccess" href="#">request access</a>,
provide your email address, and tell me who in the extended Ketrenos
universe you know. If you're not a bot, I'll very likely give you access :)</p>
<a on-tap="requestAccess" href="#">request access</a>,
provide your email address, and tell me who in the extended Ketrenos
universe you know. If you're not a bot, I'll very likely give you access :)</p>
</div>
<paper-input tabindex=0 autofocus id="username" label="User ID" value="{{username}}" on-keypress="enterCheck"></paper-input>
<paper-input tabindex=0 id="password" label="Password" type="password" value="{{password}}" on-keypress="enterCheck"></paper-input>
<paper-button tabindex=0 id="loginButton" disabled$="[[disableLogin(username,password)]]" on-tap="login" raised><div hidden$="[[loggingIn]]">login</div><div hidden$="[[!loggingIn]]"><paper-spinner active$="[[loggingIn]]"></paper-spinner></div></paper-button>
</div>
</div>
</div>
</iron-pages>
</app-header-layout>
</app-drawer-layout>
<div id="pager">pager</div>
@ -373,7 +379,7 @@
<div>item</div>
</template>
</div>
<paper-dialog id="requestAccess" modal>
<paper-dialog id="requestAccess" with-backdrop>
<div class="layout vertical">
<div class="title">Create an account</div>
<div>
@ -459,7 +465,7 @@
},
mode: {
type: String,
value: "login"
value: "loading"
},
date: {
type: String,
@ -1236,9 +1242,13 @@
},
userChanged: function(user) {
if (!this.firstRequest) {
this.mode = "loading";
return;
}
this.resetPhotos();
this.path = "";
this.mode = "";
if (user) {
this.mode = "memories";
} else {
@ -1265,7 +1275,10 @@
}.bind(this), 100);
this.loading = true;
this.firstRequest = false;
window.fetch("api/v1/users", function(error, xhr) {
this.firstRequest = true;
this.loading = false;
if (error) {
@ -1286,6 +1299,12 @@
if (results && results.username) {
this.user = results;
} else {
if (this.user) {
this.user = null;
} else {
this.userChanged(this.user);
}
}
}.bind(this));

View File

@ -33,7 +33,7 @@ function ldapPromise(username, password) {
return Promise.reject("LDAP not being used");
}
return new Promise(function(resolve, reject) {
ldap.authenticate(username, password, function(error, user) {
ldap.authenticate(username.replace(/@.*$/, ""), password, function(error, user) {
if (error) {
return reject(error);
}