mirror of
https://github.com/photoprism/photoprism.git
synced 2025-12-12 00:34:13 +01:00
Add stub for login page #16
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
12
frontend/package-lock.json
generated
12
frontend/package-lock.json
generated
@@ -5409,9 +5409,9 @@
|
||||
}
|
||||
},
|
||||
"handlebars": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.2.0.tgz",
|
||||
"integrity": "sha512-Kb4xn5Qh1cxAKvQnzNWZ512DhABzyFNmsaJf3OAkWNa4NkaqWcNI8Tao8Tasi0/F4JD9oyG0YxuFyvyR57d+Gw==",
|
||||
"version": "4.5.1",
|
||||
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.5.1.tgz",
|
||||
"integrity": "sha512-C29UoFzHe9yM61lOsIlCE5/mQVGrnIOrOq7maQl76L7tYPCgC1og0Ajt6uWnX4ZTxBPnjw+CUvawphwCfJgUnA==",
|
||||
"requires": {
|
||||
"neo-async": "^2.6.0",
|
||||
"optimist": "^0.6.1",
|
||||
@@ -5713,9 +5713,9 @@
|
||||
"integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM="
|
||||
},
|
||||
"https-proxy-agent": {
|
||||
"version": "2.2.2",
|
||||
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.2.tgz",
|
||||
"integrity": "sha512-c8Ndjc9Bkpfx/vCJueCPy0jlP4ccCCSNDp8xwCZzPjKJUm+B+u9WX2x98Qx4n1PiMNTWo3D7KK5ifNV/yJyRzg==",
|
||||
"version": "2.2.4",
|
||||
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz",
|
||||
"integrity": "sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg==",
|
||||
"requires": {
|
||||
"agent-base": "^4.3.0",
|
||||
"debug": "^3.1.0"
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
import Api from "common/api";
|
||||
import User from "model/user";
|
||||
import Api from "./api";
|
||||
import User from "../model/user";
|
||||
|
||||
class Session {
|
||||
export default class Session {
|
||||
/**
|
||||
* @param {Storage} storage
|
||||
*/
|
||||
constructor(storage) {
|
||||
this.storage = storage;
|
||||
if(storage.getItem("session_storage") === "true") {
|
||||
this.storage = window.sessionStorage;
|
||||
} else {
|
||||
this.storage = storage;
|
||||
}
|
||||
|
||||
this.session_token = this.storage.getItem("session_token");
|
||||
|
||||
const userJson = this.storage.getItem("user");
|
||||
@@ -14,6 +19,17 @@ class Session {
|
||||
this.user = userJson !== "undefined" ? new User(JSON.parse(userJson)) : null;
|
||||
}
|
||||
|
||||
useSessionStorage() {
|
||||
this.deleteToken();
|
||||
this.storage.setItem("session_storage", "true");
|
||||
this.storage = window.sessionStorage;
|
||||
}
|
||||
|
||||
useLocalStorage() {
|
||||
this.storage.setItem("session_storage", "false");
|
||||
this.storage = window.localStorage;
|
||||
}
|
||||
|
||||
setToken(token) {
|
||||
this.session_token = token;
|
||||
this.storage.setItem("session_token", token);
|
||||
@@ -48,14 +64,6 @@ class Session {
|
||||
return "";
|
||||
}
|
||||
|
||||
getFullName() {
|
||||
if (this.isUser()) {
|
||||
return this.user.userFirstName + " " + this.user.userLastName;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
getFirstName() {
|
||||
if (this.isUser()) {
|
||||
return this.user.userFirstName;
|
||||
@@ -64,16 +72,24 @@ class Session {
|
||||
return "";
|
||||
}
|
||||
|
||||
getFullName() {
|
||||
if (this.isUser()) {
|
||||
return this.user.userFirstName + " " + this.user.userLastName;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
isUser() {
|
||||
return this.user.hasId();
|
||||
return this.user && this.user.hasId();
|
||||
}
|
||||
|
||||
isAdmin() {
|
||||
return this.user.hasId() && this.user.userRole === "admin";
|
||||
return this.user && this.user.hasId() && this.user.userRole === "admin";
|
||||
}
|
||||
|
||||
isAnonymous() {
|
||||
return !this.user.hasId();
|
||||
return !this.user || !this.user.hasId();
|
||||
}
|
||||
|
||||
deleteUser() {
|
||||
@@ -104,5 +120,3 @@ class Session {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default Session;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<template>
|
||||
<div id="p-navigation">
|
||||
<v-toolbar dark scroll-off-screen color="grey darken-3" class="hidden-lg-and-up p-navigation-small" @click.stop="showNavigation()">
|
||||
<v-toolbar dark scroll-off-screen color="grey darken-3" class="hidden-lg-and-up p-navigation-small"
|
||||
@click.stop="showNavigation()">
|
||||
<v-toolbar-side-icon class="p-navigation-show"></v-toolbar-side-icon>
|
||||
|
||||
<v-toolbar-title class="p-navigation-title">{{ $router.currentRoute.meta.area }}</v-toolbar-title>
|
||||
@@ -58,13 +59,13 @@
|
||||
</v-list-tile-content>
|
||||
</v-list-tile>
|
||||
|
||||
<v-list-tile :to="{ name: 'Photos', query: { q: 'mono:true' }}" :exact="true" @click="">
|
||||
<v-list-tile :to="{name: 'photos', query: { q: 'mono:true' }}" :exact="true" @click="">
|
||||
<v-list-tile-content>
|
||||
<v-list-tile-title>Monochrome</v-list-tile-title>
|
||||
</v-list-tile-content>
|
||||
</v-list-tile>
|
||||
|
||||
<v-list-tile :to="{ name: 'Photos', query: { q: 'chroma:50' }}" :exact="true" @click="">
|
||||
<v-list-tile :to="{name: 'photos', query: { q: 'chroma:50' }}" :exact="true" @click="">
|
||||
<v-list-tile-content>
|
||||
<v-list-tile-title>Vibrant</v-list-tile-title>
|
||||
</v-list-tile-content>
|
||||
|
||||
@@ -125,7 +125,7 @@
|
||||
},
|
||||
openAlbum(index) {
|
||||
const album = this.results[index];
|
||||
this.$router.push({name: 'Photos', query: {q: "album:" + album.AlbumSlug}});
|
||||
this.$router.push({name: "photos", query: {q: "album:" + album.AlbumSlug}});
|
||||
},
|
||||
loadMore() {
|
||||
if (this.scrollDisabled) return;
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
staticFilter: Object
|
||||
},
|
||||
watch: {
|
||||
'$route' () {
|
||||
'$route'() {
|
||||
const query = this.$route.query;
|
||||
|
||||
this.filter.q = query['q'];
|
||||
@@ -121,7 +121,7 @@
|
||||
},
|
||||
openLabel(index) {
|
||||
const label = this.results[index];
|
||||
this.$router.push({name: 'Photos', query: {q: "label:" + label.LabelSlug}});
|
||||
this.$router.push({name: "photos", query: {q: "label:" + label.LabelSlug}});
|
||||
},
|
||||
loadMore() {
|
||||
if (this.scrollDisabled) return;
|
||||
|
||||
29
frontend/src/pages/login.vue
Normal file
29
frontend/src/pages/login.vue
Normal file
@@ -0,0 +1,29 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-toolbar flat color="blue-grey lighten-4">
|
||||
<v-toolbar-title>Login</v-toolbar-title>
|
||||
|
||||
<v-spacer></v-spacer>
|
||||
</v-toolbar>
|
||||
|
||||
<v-container>
|
||||
<p>
|
||||
Issues labeled <a href="https://github.com/photoprism/photoprism/labels/help%20wanted">help wanted</a> /
|
||||
<a href="https://github.com/photoprism/photoprism/labels/easy">easy</a> can be good (first)
|
||||
contributions.
|
||||
Our <a href="https://github.com/photoprism/photoprism/wiki">Developer Guide</a> contains all information
|
||||
necessary to get you started.
|
||||
</p>
|
||||
</v-container>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'login',
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
methods: {}
|
||||
};
|
||||
</script>
|
||||
@@ -86,15 +86,15 @@
|
||||
const photo = this.results[index];
|
||||
|
||||
if (photo.PhotoLat && photo.PhotoLong) {
|
||||
this.$router.push({name: 'Places', query: {lat: photo.PhotoLat, long: photo.PhotoLong}});
|
||||
this.$router.push({name: "places", query: {lat: photo.PhotoLat, long: photo.PhotoLong}});
|
||||
} else if (photo.LocName) {
|
||||
this.$router.push({name: 'Places', query: {q: photo.LocName}});
|
||||
this.$router.push({name: "places", query: {q: photo.LocName}});
|
||||
} else if (photo.LocCity) {
|
||||
this.$router.push({name: 'Places', query: {q: photo.LocCity}});
|
||||
this.$router.push({name: "places", query: {q: photo.LocCity}});
|
||||
} else if (photo.LocCountry) {
|
||||
this.$router.push({name: 'Places', query: {q: photo.LocCountry}});
|
||||
this.$router.push({name: "places", query: {q: photo.LocCountry}});
|
||||
} else {
|
||||
this.$router.push({name: 'Places', query: {q: photo.CountryName}});
|
||||
this.$router.push({name: "places", query: {q: photo.CountryName}});
|
||||
}
|
||||
},
|
||||
openPhoto(index) {
|
||||
|
||||
@@ -175,7 +175,7 @@
|
||||
}
|
||||
},
|
||||
updateQuery() {
|
||||
this.$router.replace({query: this.query});
|
||||
this.$router.replace({query: this.query}).catch(err => {});
|
||||
|
||||
if(this.query.lat && this.query.long) {
|
||||
this.position = L.latLng(this.query.lat, this.query.long);
|
||||
@@ -194,7 +194,7 @@
|
||||
|
||||
this.updateQuery();
|
||||
|
||||
this.$router.replace({query: this.query});
|
||||
this.$router.replace({query: this.query}).catch(err => {});
|
||||
|
||||
const params = {
|
||||
count: this.pageSize,
|
||||
|
||||
@@ -7,80 +7,87 @@ import People from "pages/people.vue";
|
||||
import Library from "pages/library.vue";
|
||||
import Share from "pages/share.vue";
|
||||
import Settings from "pages/settings.vue";
|
||||
import Login from "pages/login.vue";
|
||||
import Todo from "pages/todo.vue";
|
||||
|
||||
export default [
|
||||
{
|
||||
name: "Home",
|
||||
name: "home",
|
||||
path: "/",
|
||||
redirect: "/photos",
|
||||
},
|
||||
{
|
||||
name: "Photos",
|
||||
name: "login",
|
||||
path: "/login",
|
||||
component: Login,
|
||||
meta: {area: "Login"},
|
||||
},
|
||||
{
|
||||
name: "photos",
|
||||
path: "/photos",
|
||||
component: Photos,
|
||||
meta: {area: "Photos"},
|
||||
},
|
||||
{
|
||||
name: "Albums",
|
||||
name: "albums",
|
||||
path: "/albums",
|
||||
component: Albums,
|
||||
meta: {area: "Albums"},
|
||||
},
|
||||
{
|
||||
name: "Favorites",
|
||||
name: "favorites",
|
||||
path: "/favorites",
|
||||
component: Photos,
|
||||
meta: {area: "Favorites"},
|
||||
props: {staticFilter: {favorites: true}},
|
||||
},
|
||||
{
|
||||
name: "Places",
|
||||
name: "places",
|
||||
path: "/places",
|
||||
component: Places,
|
||||
meta: {area: "Places"},
|
||||
},
|
||||
{
|
||||
name: "Labels",
|
||||
name: "labels",
|
||||
path: "/labels",
|
||||
component: Labels,
|
||||
meta: {area: "Labels"},
|
||||
},
|
||||
{
|
||||
name: "Events",
|
||||
name: "events",
|
||||
path: "/events",
|
||||
component: Events,
|
||||
meta: {area: "Events"},
|
||||
},
|
||||
{
|
||||
name: "People",
|
||||
name: "people",
|
||||
path: "/people",
|
||||
component: People,
|
||||
meta: {area: "People"},
|
||||
},
|
||||
{
|
||||
name: "Filters",
|
||||
name: "filters",
|
||||
path: "/filters",
|
||||
component: Todo,
|
||||
meta: {area: "Filters"},
|
||||
},
|
||||
{
|
||||
name: "Library",
|
||||
name: "library",
|
||||
path: "/library",
|
||||
component: Library,
|
||||
meta: {area: "Library"},
|
||||
meta: {area: "Library", auth: true},
|
||||
},
|
||||
{
|
||||
name: "Share",
|
||||
name: "share",
|
||||
path: "/share",
|
||||
component: Share,
|
||||
meta: {area: "Share"},
|
||||
meta: {area: "Share", auth: true},
|
||||
},
|
||||
{
|
||||
name: "Settings",
|
||||
name: "settings",
|
||||
path: "/settings",
|
||||
component: Settings,
|
||||
meta: {area: "Settings"},
|
||||
meta: {area: "Settings", auth: true},
|
||||
},
|
||||
{
|
||||
path: "*", redirect: "/photos",
|
||||
|
||||
@@ -199,7 +199,7 @@ const config = {
|
||||
// No sourcemap for production
|
||||
if (isDev) {
|
||||
const devToolPlugin = new webpack.SourceMapDevToolPlugin({
|
||||
filename: "[name].map",
|
||||
filename: "[file].map",
|
||||
});
|
||||
|
||||
config.plugins.push(devToolPlugin);
|
||||
|
||||
Reference in New Issue
Block a user