#225 require account to propose entries

This commit is contained in:
Avris 2021-07-25 09:50:02 +02:00
parent 8cfb41ef33
commit e85133ce04
17 changed files with 47 additions and 4 deletions

View File

@ -1,5 +1,5 @@
<template>
<section>
<section v-if="$user()">
<div v-if="afterSubmit" class="alert alert-success text-center">
<p>
<T>nouns.submit.thanks</T>
@ -78,6 +78,11 @@
<p class="small text-muted mt-1"><T>nouns.submit.moderation</T></p>
</form>
</section>
<section v-else class="text-center">
<div class="alert alert-info">
<T>crud.loginRequired</T>
</div>
</section>
</template>
<script>

View File

@ -1,5 +1,5 @@
<template>
<section>
<section v-if="$user()">
<div v-if="afterSubmit" class="alert alert-success text-center">
<p>
<T>nouns.submit.thanks</T>
@ -117,6 +117,11 @@
<p class="small text-muted mt-1"><T>nouns.submit.moderation</T></p>
</form>
</section>
<section v-else class="text-center">
<div class="alert alert-info">
<T>crud.loginRequired</T>
</div>
</section>
</template>
<script>

View File

@ -4,7 +4,7 @@
<Icon v="plus-circle"/>
<T>sources.submit.header</T>
</div>
<div class="card-body">
<div v-if="$user()" class="card-body">
<div v-if="afterSubmit" class="alert alert-success text-center">
<p>
<T>sources.submit.thanks</T>
@ -99,6 +99,9 @@
<p class="small text-muted mt-1"><T>sources.submit.moderation</T></p>
</form>
</div>
<div v-else class="card-body py-5 text-center">
<T>crud.loginRequired</T>
</div>
</div>
</template>

View File

@ -1,5 +1,5 @@
<template>
<section>
<section v-if="$user()">
<div v-if="afterSubmit" class="alert alert-success text-center">
<p>
<T>nouns.submit.thanks</T>
@ -87,6 +87,11 @@
<p class="small text-muted mt-1"><T>nouns.submit.moderation</T></p>
</form>
</section>
<section v-else class="text-center">
<div class="alert alert-info">
<T>crud.loginRequired</T>
</div>
</section>
</template>
<script>

View File

@ -432,6 +432,7 @@ crud:
search: 'Suchen…'
author: 'Hinzugefügt von'
saved: 'Änderungen erfolgreich gespeichert!'
loginRequired: '{/account=Log in} to submit an entry' # TODO
footer:
license: >

View File

@ -530,6 +530,7 @@ crud:
search: 'Search…'
author: 'Added by'
saved: 'Changes saved successfully!'
loginRequired: '{/account=Log in} to submit an entry'
footer:
license: >

View File

@ -441,6 +441,7 @@ crud:
search: 'Buscar…'
author: 'Añadido por'
saved: 'Los cambios se guardaron exitosamente!'
loginRequired: '{/cuenta=Log in} to submit an entry' # TODO
footer:
license: >

View File

@ -429,6 +429,7 @@ crud:
search: 'Chercher…'
author: 'Créé par'
saved: 'Changes saved successfully!' # TODO
loginRequired: '{/account=Log in} to submit an entry' # TODO
footer:
# old version 'Code source a {https://gitlab.com/Avris/Zaimki=published} sous la {https://mit.avris.it=MIT} license.'

View File

@ -437,6 +437,7 @@ crud:
search: 'Zoek…'
author: 'Toegevoegd door'
saved: 'Veranderingen succesvol opgeslagen!'
loginRequired: '{/account=Log in} to submit an entry' # TODO
footer:
# TODO source: 'De broncode wordt {https://gitlab.com/Avris/Zaimki=gepubliceerd} onder de {https://mit.avris.it=MIT}-licentie.'

View File

@ -1043,6 +1043,7 @@ crud:
search: 'Szukaj…'
author: 'Dodane przez'
saved: 'Zmiany zapisane!'
loginRequired: '{/konto=Zaloguj się}, aby zgłosić wpis'
footer:
source: 'Kod jest {https://gitlab.com/Avris/Zaimki=udostępniony} na licencji {https://mit.avris.it=MIT}.'

View File

@ -440,6 +440,7 @@ crud:
search: 'Buscar…'
author: 'Adicionado por'
saved: 'Alterações salvas com sucesso!'
loginRequired: '{/conta=Log in} to submit an entry' # TODO
footer:
# TODO source: 'O código fonte está {https://gitlab.com/Avris/Zaimki=publicado} baixo da licença {https://mit.avris.it=MIT}.'

View File

@ -455,6 +455,7 @@ crud:
search: 'Search…'
author: 'Added by'
saved: 'Changes saved successfully!' # TODO
loginRequired: '{/account=Log in} to submit an entry' # TODO
footer:
license: >

View File

@ -407,6 +407,7 @@ profile:
link: 'Card picture'
generating: 'Generation in progress…'
empty: 'This person hasn''t created any cards yet.' # TODO
loginRequired: '{/account=Log in} to submit an entry' # TODO
share: '這裡'

View File

@ -49,6 +49,10 @@ router.get('/inclusive/search/:term', handleErrorAsync(async (req, res) => {
}));
router.post('/inclusive/submit', handleErrorAsync(async (req, res) => {
if (!req.user) {
res.status(401).json({error: 'Unauthorised'});
}
if (!(req.user && req.user.admin) && isTroll(JSON.stringify(req.body))) {
return res.json('ok');
}

View File

@ -97,6 +97,10 @@ router.get('/nouns/search/:term', handleErrorAsync(async (req, res) => {
}));
router.post('/nouns/submit', handleErrorAsync(async (req, res) => {
if (!req.user) {
res.status(401).json({error: 'Unauthorised'});
}
if (!(req.user && req.user.admin) && isTroll(JSON.stringify(req.body))) {
return res.json('ok');
}

View File

@ -73,6 +73,10 @@ router.get('/sources/:id', handleErrorAsync(async (req, res) => {
}));
router.post('/sources/submit', handleErrorAsync(async (req, res) => {
if (!req.user) {
res.status(401).json({error: 'Unauthorised'});
}
const id = ulid();
await req.db.get(SQL`
INSERT INTO sources (id, locale, pronouns, type, author, title, extra, year, fragments, comment, link, key, images, submitter_id, base_id)

View File

@ -48,6 +48,10 @@ router.get('/terms/search/:term', handleErrorAsync(async (req, res) => {
}));
router.post('/terms/submit', handleErrorAsync(async (req, res) => {
if (!req.user) {
res.status(401).json({error: 'Unauthorised'});
}
if (!(req.user && req.user.admin) && isTroll(JSON.stringify(req.body))) {
return res.json('ok');
}