#130 [bug] `/editor` shows 404, not login form

This commit is contained in:
Avris 2020-12-11 20:37:04 +01:00
parent a4f57fc775
commit 75d3605ded
11 changed files with 46 additions and 9 deletions

View File

@ -132,6 +132,14 @@
async mounted() {
this.profiles = await this.$axios.$get(`/profile/get/${this.$user().username}`);
this.socialConnections = await this.$axios.$get(`/user/social-connections`);
if (process.client) {
const redirectTo = window.sessionStorage.getItem('after-login');
if (this.$user() && redirectTo) {
window.sessionStorage.removeItem('after-login')
await this.$router.push(redirectTo);
}
}
},
methods: {
async changeUsername() {

15
components/MustLogin.vue Normal file
View File

@ -0,0 +1,15 @@
<template>
<div>
<h2>
<Icon v="shield"/>
<T>authRequired.message</T>
</h2>
<p class="h4 mt-4">
<nuxt-link :to="'/' + config.user.route">
<Icon v="sign-in"/>
<T>authRequired.go</T>
</nuxt-link>
</p>
</div>
</template>

View File

@ -407,6 +407,10 @@ notFound:
message: 'Page was not found'
back: 'Go back to the homepage'
authRequired:
message: 'You must log in to see this site'
go: 'Go to the login form'
confirm:
header: 'Are you sure?'
yes: 'Yes, I''m sure'

View File

@ -908,6 +908,10 @@ notFound:
message: 'Strony nie znaleziono'
back: 'Wróć na główną'
authRequired:
message: 'Musisz się zalogować, by zobaczyć tę stronę'
go: 'Przejdź do logowania'
confirm:
header: 'Czy jesteś pewnx?'
yes: 'Tak, na pewno'
@ -974,7 +978,7 @@ flags:
Diamoric: 'Diamoryczn{adjective_n}'
Enbian: 'Enbiańsk{adjective_n_alt}' # Niebiańsk{adjective_n}
Gay: 'Gej'
Gender_Questioning: 'Kwestionując{adjective_n} swoją płeć' # Zastanawiając{adjective_n} się nad swoją płcią
Gender_Questioning: 'Rozważając_ {adjective_n} swoją płeć' # Zastanawiając{adjective_n} się nad swoją płcią
Genderfae: 'Nimficzn{adjective_n}'
Genderfaun: 'Fauniczn{adjective_n}'
Genderfluid: 'Płynnopłciow{adjective_n}'

View File

@ -1,5 +1,5 @@
<template>
<div class="container">
<div>
<h2>
<Icon v="laptop-code"/>
<T>api.header</T>

View File

@ -1,6 +1,6 @@
<template>
<NotFound v-if="!content"/>
<div v-else class="container blog-post">
<div v-else class="blog-post">
<div v-html="content"></div>
</div>
</template>

View File

@ -1,5 +1,5 @@
<template>
<div class="container">
<div>
<h2>
<Icon v="comment-alt-smile"/>
<T>contact.header</T>

View File

@ -1,5 +1,5 @@
<template>
<div class="container">
<div>
<h2>
<Icon v="tags"/>
<T>home.why</T>

View File

@ -1,6 +1,6 @@
<template>
<NotFound v-if="!$user()"/>
<div v-else class="container">
<MustLogin v-if="!$user()"/>
<div v-else>
<div class="mb-3 d-flex justify-content-between flex-column flex-md-row">
<h2 class="text-nowrap">
<Avatar :user="$user()"/>
@ -172,6 +172,12 @@
words: defaultWords,
};
},
mounted() {
if (process.client && !this.$user()) {
window.sessionStorage.setItem('after-login', window.location.pathname);
this.$router.push('/' + this.config.user.route);
}
},
methods: {
async save() {
this.saving = true;

View File

@ -1,5 +1,5 @@
<template>
<div class="container">
<div>
<div class="list-group">
<a v-for="(options, locale) in locales" :key="locale" :href="options.url" class="list-group-item list-group-item-action list-group-item-hoverable">
<div class="h3">

View File

@ -1,5 +1,5 @@
<template>
<div class="container">
<div>
<h2>
<Icon v="gavel"/>
<T>terms.header</T>