Another batch of important updates and fixes
This commit is contained in:
@@ -25,6 +25,6 @@ exports.TEMP_EXPORT_PATH = `${DATA_FILES_PATH}/export_temp`
|
||||
|
||||
exports.MAX_EXTRACTIONS_PER_USER = 5
|
||||
|
||||
exports.ACTIVATION_TOKEN_VALID_DAYS = 7
|
||||
exports.ACTIVATION_TOKEN_VALID_DAYS = 2
|
||||
|
||||
exports.CHANGE_EMAIL_TOKEN_VALID_DAYS = 7
|
||||
|
||||
@@ -12,6 +12,15 @@ exports.listComments = async (req, res) => {
|
||||
}
|
||||
|
||||
if (filters.ctxType === 'entry_dict_int') {
|
||||
if (!filters.ctxId) {
|
||||
const NO_COMMENTS_OBJECT = {
|
||||
page: 1,
|
||||
numberOfAllPages: 1,
|
||||
comments: [],
|
||||
commentCount: 0
|
||||
}
|
||||
return res.send(NO_COMMENTS_OBJECT)
|
||||
}
|
||||
const { dictionary_id: dictionaryId } = await Entry.fetch(filters.ctxId)
|
||||
const isEditor = req.user.hasAnyDictionaryRole(dictionaryId)
|
||||
const isPortalAdmin = req.user.hasRole('portal admin')
|
||||
|
||||
@@ -123,6 +123,8 @@ consultancy.createQuestion = async (req, res) => {
|
||||
subject: subjectText,
|
||||
html: emailHtml
|
||||
})
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Sent email to ${emails} (subject: ${subjectText})`)
|
||||
|
||||
res.status(201).send()
|
||||
}
|
||||
@@ -233,11 +235,14 @@ consultancy.assign = async (req, res) => {
|
||||
const emailHtml = await renderAsync('email/consultancy-assigned')
|
||||
|
||||
// TODO i18n - What language are the email title and content (we already have email translated)
|
||||
const emailSubject = req.t('Novo terminološko vprašanje')
|
||||
await email.send({
|
||||
to: emails,
|
||||
subject: req.t('Novo terminološko vprašanje'),
|
||||
subject: emailSubject,
|
||||
html: emailHtml
|
||||
})
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Sent email to ${emails} (subject: ${emailSubject})`)
|
||||
|
||||
res.send()
|
||||
}
|
||||
@@ -289,11 +294,14 @@ consultancy.sendToReview = async (req, res) => {
|
||||
const emailHtml = await renderAsync('email/consultancy-item-review')
|
||||
|
||||
// TODO i18n - What language are the email title and content (we already have email translated)
|
||||
const emailSubject = req.t('Potrditev objave')
|
||||
await email.send({
|
||||
to: emails,
|
||||
subject: req.t('Potrditev objave'),
|
||||
subject: emailSubject,
|
||||
html: emailHtml
|
||||
})
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Sent email to ${emails} (subject: ${emailSubject})`)
|
||||
|
||||
res.send()
|
||||
}
|
||||
@@ -318,13 +326,16 @@ consultancy.publish = async (req, res) => {
|
||||
portalName
|
||||
}
|
||||
)
|
||||
const emailSubject = i18next.t('Objava terminološkega vprašanja', {
|
||||
lng: author.language
|
||||
})
|
||||
await email.send({
|
||||
to: author.email,
|
||||
subject: i18next.t('Objava terminološkega vprašanja', {
|
||||
lng: author.language
|
||||
}),
|
||||
subject: emailSubject,
|
||||
html: emailHtml
|
||||
})
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Sent email to ${author.email} (subject: ${emailSubject})`)
|
||||
|
||||
await ConsultancyEntry.publish(questionId, answerAuthors)
|
||||
await ConsultancyEntry.indexIntoSearchEngine(questionId, true)
|
||||
|
||||
@@ -55,7 +55,7 @@ dictionary.updateEntry = async (req, res) => {
|
||||
}
|
||||
|
||||
dictionary.fetchEntries = async (req, res) => {
|
||||
const dictionaryId = req.query.id
|
||||
const { dictionaryId } = req.query
|
||||
const hitsQuery = genEditorAllQuery(dictionaryId)
|
||||
const hits = await searchEntryIndex(hitsQuery)
|
||||
|
||||
|
||||
@@ -218,11 +218,14 @@ extraction.begin = async (req, res) => {
|
||||
extractionLink
|
||||
}
|
||||
)
|
||||
const emailSubject = i18next.t('Luščenje končano', { lng: authorLanguage })
|
||||
await email.send({
|
||||
to: authorEmail,
|
||||
subject: i18next.t('Luščenje končano', { lng: authorLanguage }),
|
||||
subject: emailSubject,
|
||||
html: emailHtml
|
||||
})
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Sent email to ${authorEmail} (subject: ${emailSubject})`)
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(error)
|
||||
|
||||
@@ -18,7 +18,8 @@ users.listUsers = async (req, res) => {
|
||||
|
||||
const { pages_total: numberOfAllPages, results } = await User.fetchAll(
|
||||
resultsPerPage,
|
||||
page
|
||||
page,
|
||||
true
|
||||
)
|
||||
|
||||
res.send({ page, numberOfAllPages, results })
|
||||
@@ -63,11 +64,14 @@ users.updateBasicData = async (req, res) => {
|
||||
changeEmailLink
|
||||
}
|
||||
)
|
||||
const emailSubject = req.t('Sprememba elektronskega naslova')
|
||||
await email.send({
|
||||
to: newEmail,
|
||||
subject: req.t('Sprememba elektronskega naslova'),
|
||||
subject: emailSubject,
|
||||
html: emailHtml
|
||||
})
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Sent email to ${newEmail} (subject: ${emailSubject})`)
|
||||
|
||||
const message =
|
||||
req.t(
|
||||
@@ -103,11 +107,14 @@ users.updatePassword = async (req, res) => {
|
||||
username: req.user.userName
|
||||
}
|
||||
)
|
||||
const emailSubject = req.t('Sprememba gesla')
|
||||
await email.send({
|
||||
to: req.user.email,
|
||||
subject: req.t('Sprememba gesla'),
|
||||
subject: emailSubject,
|
||||
html: emailHtml
|
||||
})
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Sent email to ${req.user.email} (subject: ${emailSubject})`)
|
||||
|
||||
req.flash('info', 'Geslo je bilo spremenjeno.')
|
||||
res.send()
|
||||
|
||||
@@ -76,11 +76,14 @@ exports.minEntriesRequirementCheckAndAct = {
|
||||
})
|
||||
|
||||
// TODO i18n - What language are the email title and content (we already have email translated)
|
||||
const emailSubject = __('Obvestilo o številu gesel')
|
||||
await email.send({
|
||||
to: allEmails,
|
||||
subject: __('Obvestilo o številu gesel'),
|
||||
subject: emailSubject,
|
||||
html: emailHtml
|
||||
})
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Sent email to ${allEmails} (subject: ${emailSubject})`)
|
||||
|
||||
await minEntriesEmailBookmark.set(dictionaryId)
|
||||
},
|
||||
@@ -207,9 +210,12 @@ async function renderAndSendStatusChangeEmails(
|
||||
})
|
||||
|
||||
// TODO i18n - What language are the email title and content (we already have email translated)
|
||||
const emailSubject = __('Sprememba stanja slovarja')
|
||||
await email.send({
|
||||
to: targetEmails,
|
||||
subject: __('Sprememba stanja slovarja'),
|
||||
subject: emailSubject,
|
||||
html: emailHtml
|
||||
})
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Sent email to ${targetEmails} (subject: ${emailSubject})`)
|
||||
}
|
||||
|
||||
@@ -442,18 +442,31 @@ exports.entryDetails = async (req, res) => {
|
||||
}
|
||||
|
||||
/* entryData.entry.foreign_entries.forEach((val, idx) => {
|
||||
entry.foreignEntries[idx] = await
|
||||
entry.foreignEntries[idx] = await
|
||||
}) */
|
||||
|
||||
const langs = await Dictionary.fetchLanguages(
|
||||
const allowedLangauges = await Dictionary.fetchLanguages(
|
||||
entryData.dictionary_id,
|
||||
req.determinedLanguage
|
||||
)
|
||||
entryData.foreign_entries.forEach((val, idx) => {
|
||||
try {
|
||||
entry.foreign_entries[idx].name = langs[idx].name
|
||||
} catch (e) {}
|
||||
})
|
||||
const allowedLanguageIDs = allowedLangauges.reduce((agg, el, index) => {
|
||||
agg[el.id] = el.name
|
||||
|
||||
return agg
|
||||
}, {})
|
||||
|
||||
if (entryData.foreign_entries) {
|
||||
entryData.foreign_entries = entryData.foreign_entries.filter(item => {
|
||||
return Object.keys(allowedLanguageIDs).includes(`${item.language_id}`)
|
||||
})
|
||||
|
||||
entryData.foreign_entries.forEach((val, idx) => {
|
||||
try {
|
||||
entry.foreign_entries[idx].name =
|
||||
allowedLanguageIDs[entry.foreign_entries[idx].language_id]
|
||||
} catch (e) {}
|
||||
})
|
||||
}
|
||||
|
||||
res.render('pages/search/result-detail', {
|
||||
allPrimaryDomains,
|
||||
@@ -515,11 +528,14 @@ exports.changeEmail = async (req, res) => {
|
||||
username: user.username
|
||||
}
|
||||
)
|
||||
const emailSubject = req.t('Sprememba elektronskega naslova - uspeh')
|
||||
await email.send({
|
||||
to: user.email,
|
||||
subject: req.t('Sprememba elektronskega naslova - uspeh'),
|
||||
subject: emailSubject,
|
||||
html: emailHtml
|
||||
})
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Sent email to ${user.email} (subject: ${emailSubject})`)
|
||||
|
||||
req.flash('info', req.t('Uspešno ste spremenili svoj elektronski naslov.'))
|
||||
if (req.user) return res.redirect(303, '/moj-racun')
|
||||
|
||||
@@ -2,6 +2,7 @@ const { randomBytes } = require('crypto')
|
||||
const { promisify } = require('util')
|
||||
const passport = require('passport')
|
||||
const User = require('../models/user')
|
||||
const Misc = require('../models/system/misc')
|
||||
const email = require('../models/email')
|
||||
const { logout: logoutUser } = require('../middleware/user')
|
||||
const { origin } = require('../config/keys')
|
||||
@@ -14,6 +15,11 @@ const user = {}
|
||||
user.register = async (req, res) => {
|
||||
// TODO Add validation.
|
||||
|
||||
if (req.body.userTag) {
|
||||
await Misc.logHoneypotCatch(req.body)
|
||||
return res.send(req.t('Registracija uspešna'))
|
||||
}
|
||||
|
||||
const userId = await User.create(
|
||||
{
|
||||
...req.body,
|
||||
@@ -32,11 +38,14 @@ user.register = async (req, res) => {
|
||||
username,
|
||||
activationLink
|
||||
})
|
||||
const emailSubject = req.t('Aktivacija računa')
|
||||
await email.send({
|
||||
to: userEmail,
|
||||
subject: req.t('Aktivacija računa'),
|
||||
subject: emailSubject,
|
||||
html: emailHtml
|
||||
})
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Sent email to ${userEmail} (subject: ${emailSubject})`)
|
||||
res.send(req.t('Registracija uspešna'))
|
||||
}
|
||||
|
||||
@@ -136,11 +145,14 @@ user.generateResetPasswordToken = async (req, res) => {
|
||||
resetPasswordLink
|
||||
}
|
||||
)
|
||||
const emailSubject = req.t('Ponastavitev gesla')
|
||||
await email.send({
|
||||
to: userEmail,
|
||||
subject: req.t('Ponastavitev gesla'),
|
||||
subject: emailSubject,
|
||||
html: emailHtml
|
||||
})
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Sent email to ${userEmail} (subject: ${emailSubject})`)
|
||||
res.send()
|
||||
}
|
||||
|
||||
@@ -162,11 +174,14 @@ user.changePassword = async (req, res) => {
|
||||
username: user.username
|
||||
}
|
||||
)
|
||||
const emailSubject = req.t('Uspešna ponastavitev gesla')
|
||||
await email.send({
|
||||
to: user.email,
|
||||
subject: req.t('Uspešna ponastavitev gesla'),
|
||||
subject: emailSubject,
|
||||
html: emailHtml
|
||||
})
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Sent email to ${user.email} (subject: ${emailSubject})`)
|
||||
|
||||
req.flash('info', req.t('Vaše geslo je bilo uspešno ponastavljeno.'))
|
||||
|
||||
@@ -186,7 +201,8 @@ user.list = async (req, res) => {
|
||||
|
||||
const { pages_total: numberOfAllPages, results } = await User.fetchAll(
|
||||
resultsPerPage,
|
||||
1
|
||||
1,
|
||||
true
|
||||
)
|
||||
res.render('pages/admin/user-list', {
|
||||
title: req.t('Seznam uporabnikov'),
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
const { getInstanceSetting } = require('../models/helpers')
|
||||
const Entry = require('../models/entry')
|
||||
|
||||
exports.enhanceLocals = async (req, res, next) => {
|
||||
res.locals.portalCode = await getInstanceSetting('portal_code')
|
||||
@@ -12,3 +13,11 @@ exports.adjustHeaders = async (req, res, next) => {
|
||||
|
||||
next()
|
||||
}
|
||||
|
||||
exports.setDerivedDictionaryIdFromEntryId = async (req, res, next) => {
|
||||
const { entryId } = req.query
|
||||
const { dictionary_id: dictionaryId } = await Entry.fetch(entryId)
|
||||
req.derivedDictionaryId = dictionaryId
|
||||
|
||||
next()
|
||||
}
|
||||
|
||||
@@ -53,7 +53,8 @@ user.isDictionaryEditor = (req, res, next) => {
|
||||
}
|
||||
|
||||
user.canAdministrateDictionary = (req, res, next) => {
|
||||
const dictionaryId = req.params.dictionaryId || req.dictionaryId
|
||||
const dictionaryId =
|
||||
req.params.dictionaryId || req.query.dictionaryId || req.dictionaryId
|
||||
const isAdmin = req.user.hasDictionaryRole(dictionaryId, 'administration')
|
||||
const isPortalAdmin = req.user.hasRole('portal admin')
|
||||
const isDictionariesAdmin = req.user.hasRole('dictionaries admin')
|
||||
@@ -73,7 +74,11 @@ user.canAdministrateDictionaries = (req, res, next) => {
|
||||
}
|
||||
|
||||
user.canContentEdit = (req, res, next) => {
|
||||
const { dictionaryId } = req.params
|
||||
const dictionaryId =
|
||||
req.params.dictionaryId ||
|
||||
req.query.dictionaryId ||
|
||||
req.body.dictionaryId ||
|
||||
req.derivedDictionaryId
|
||||
const isEditor = req.user.hasAnyDictionaryRole(dictionaryId)
|
||||
const isPortalAdmin = req.user.hasRole('portal admin')
|
||||
const isDictionariesAdmin = req.user.hasRole('dictionaries admin')
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
const db = require('../db')
|
||||
|
||||
const Misc = {}
|
||||
|
||||
// Log a successful honeypot catch.
|
||||
Misc.logHoneypotCatch = async body => {
|
||||
await db.query('INSERT INTO honeypot_log (body_content) VALUES ($1)', [body])
|
||||
}
|
||||
|
||||
module.exports = Misc
|
||||
+11
-3
@@ -330,7 +330,15 @@ User.fetchDeserializedDataById = async userId => {
|
||||
}
|
||||
|
||||
// Fetch all registered users on the portal
|
||||
User.fetchAll = async (resultsPerPage, page) => {
|
||||
User.fetchAll = async (resultsPerPage, page, hideInactive) => {
|
||||
// hideInactive was added to hide bot spammed accounts. Using the 'inactive' status might be more appropriate as a filtering criteria in the future.
|
||||
|
||||
const whereClause = `WHERE status ${
|
||||
hideInactive
|
||||
? `= 'active' OR (status = 'registered' AND NOW() - time_registered < '${ACTIVATION_TOKEN_VALID_DAYS} days')`
|
||||
: "<> 'closed'"
|
||||
}`
|
||||
|
||||
const {
|
||||
rows: [{ result }]
|
||||
} = await db.query(
|
||||
@@ -339,7 +347,7 @@ User.fetchAll = async (resultsPerPage, page) => {
|
||||
'pages_total', (
|
||||
SELECT CEIL(COUNT(*) / $1::float)
|
||||
FROM "user"
|
||||
WHERE status <> 'closed'
|
||||
${whereClause}
|
||||
),
|
||||
'results', ARRAY(
|
||||
SELECT jsonb_build_object(
|
||||
@@ -349,7 +357,7 @@ User.fetchAll = async (resultsPerPage, page) => {
|
||||
'status', status
|
||||
)
|
||||
FROM "user"
|
||||
WHERE status <> 'closed'
|
||||
${whereClause}
|
||||
ORDER BY username
|
||||
LIMIT $1
|
||||
OFFSET $2
|
||||
|
||||
@@ -9,8 +9,8 @@ window.addEventListener('load', () => {
|
||||
|
||||
function initComments() {
|
||||
const ce = {}
|
||||
ce.updatePager = initPagination('pagination', onPageChange)
|
||||
window.commentElements = ce
|
||||
ce.updatePager = initPagination('pagination', onPageChange)
|
||||
ce.commentsCountEl = document.getElementById('comments-count')
|
||||
ce.commentsContainerEl = document.getElementById('comments-container')
|
||||
ce.commentForm = document.getElementById('comment-form')
|
||||
@@ -58,16 +58,20 @@ function initComments() {
|
||||
if (/\/slovarji\/\d+\/vsebina/.test(pageURL)) {
|
||||
ce.terminsList = document.getElementById('term-list')
|
||||
if (ce.terminsList) {
|
||||
ce.terminsList.addEventListener('click', displayComments)
|
||||
ce.terminsList.addEventListener('click', () =>
|
||||
changeEntryCommentSection()
|
||||
)
|
||||
}
|
||||
const ctxBtns = document.getElementsByName('comments-type')
|
||||
if (ctxBtns) {
|
||||
const ctxBtnsArray = Array.from(ctxBtns)
|
||||
ctxBtnsArray.forEach(el => el.addEventListener('click', displayComments))
|
||||
ctxBtnsArray.forEach(el =>
|
||||
el.addEventListener('click', () => changeEntryCommentSection())
|
||||
)
|
||||
}
|
||||
}
|
||||
ce.commentMessageInput && ce.commentReplyInput && clearMessageInput()
|
||||
displayComments()
|
||||
changeEntryCommentSection()
|
||||
}
|
||||
|
||||
function autoGrow({ target: inputToResize }) {
|
||||
@@ -496,24 +500,16 @@ function normalCommentColors(selectedText, btnEyeOffEl) {
|
||||
selectedText.classList.remove('comment-white-text')
|
||||
}
|
||||
|
||||
// function getCtxId({ target }) {
|
||||
// console.log(target)
|
||||
// const termBtn = target.closest('.terms-label')
|
||||
// console.log(termBtn)
|
||||
// if (termBtn) {
|
||||
// console.log(termBtn)
|
||||
// displayComments()
|
||||
// }
|
||||
// }
|
||||
|
||||
const ctxBtns = document.getElementsByName('comments-type')
|
||||
const commentsTab = document.getElementById('content-comments')
|
||||
if (ctxBtns) {
|
||||
const ctxBtnsArray = Array.from(ctxBtns)
|
||||
ctxBtnsArray.forEach(el => el.addEventListener('click', displayComments))
|
||||
ctxBtnsArray.forEach(el =>
|
||||
el.addEventListener('click', () => changeEntryCommentSection())
|
||||
)
|
||||
}
|
||||
if (commentsTab) {
|
||||
commentsTab.addEventListener('click', displayComments)
|
||||
commentsTab.addEventListener('click', () => changeEntryCommentSection())
|
||||
}
|
||||
|
||||
function getCtxTypeId(type) {
|
||||
@@ -572,10 +568,15 @@ function checkButton(type) {
|
||||
return checked
|
||||
}
|
||||
|
||||
async function changeEntryCommentSection() {
|
||||
await onPageChange()
|
||||
}
|
||||
|
||||
async function onPageChange(newPage) {
|
||||
const { updatePager } = window.commentElements
|
||||
try {
|
||||
const { page, numberOfAllPages } = await displayComments(newPage)
|
||||
let { page, numberOfAllPages } = await displayComments(newPage)
|
||||
numberOfAllPages ||= 1
|
||||
updatePager(page, numberOfAllPages)
|
||||
} catch (error) {
|
||||
let message = i18next.t('Prišlo je do napake.')
|
||||
|
||||
@@ -544,6 +544,7 @@ function initDictionaries() {
|
||||
}
|
||||
|
||||
function handleClick({ target }) {
|
||||
// TODO Fix leaks and related server request spam. Many click action create a new object or attach a new event listener on every click.
|
||||
const term = target.closest('.terms-label')
|
||||
const versionEl = target.closest('.date-element')
|
||||
const deleteEntryEl = target.closest('#delete-entry')
|
||||
@@ -652,11 +653,11 @@ function initDictionaries() {
|
||||
} = window.dictionaryElements
|
||||
event?.preventDefault()
|
||||
const dictionaryIdElem = document.getElementById('hidden-dictionary-id')
|
||||
const dictctionaryId = dictionaryIdElem.value
|
||||
const dictionaryId = dictionaryIdElem.value
|
||||
const deleteEntry = document.getElementById('delete-entry')
|
||||
try {
|
||||
const { data } = await axios.get('/api/v1/entries', {
|
||||
params: { id: entryId, dictctionaryId: dictctionaryId }
|
||||
params: { id: entryId, dictionaryId }
|
||||
})
|
||||
insertTermData(entryId, data)
|
||||
const isPublishedEl = data.entry.is_published
|
||||
@@ -947,7 +948,7 @@ function initDictionaries() {
|
||||
const dictionaryId = hiddenEl.value
|
||||
try {
|
||||
const { data } = await axios.get('/api/v1/entries/fetch-terms', {
|
||||
params: { id: dictionaryId }
|
||||
params: { dictionaryId }
|
||||
})
|
||||
renderTerms(data, entryId)
|
||||
} catch (error) {
|
||||
|
||||
@@ -677,11 +677,21 @@ function initPagination(paginationRootElIds, onPageChange, currentPage = 1) {
|
||||
|
||||
function initControls(paginationRootElId) {
|
||||
const rootEl = document.getElementById(paginationRootElId)
|
||||
|
||||
if (!rootEl) {
|
||||
return
|
||||
}
|
||||
|
||||
const btnFirstPage = rootEl.querySelector('.first-page')
|
||||
const btnPreviousPage = rootEl.querySelector('.previous-page')
|
||||
const btnNextPage = rootEl.querySelector('.next-page')
|
||||
const btnLastPage = rootEl.querySelector('.last-page')
|
||||
const formEl = rootEl.querySelector('form')
|
||||
|
||||
if (!formEl) {
|
||||
return
|
||||
}
|
||||
|
||||
const pageInputEl = formEl.querySelector('input')
|
||||
const pagesCountDisplayEl = formEl.querySelector('.pages-total')
|
||||
|
||||
|
||||
@@ -118,7 +118,6 @@
|
||||
"ID Slovarja": "Dictionary ID",
|
||||
"ID: Ni idja": "ID: No ID",
|
||||
"IDEKSIRAJ": "INDEX",
|
||||
"Imate neshranjene spremebe. Ali jih želite shraniti?": "Your changes have not been saved. Do you want to save them?",
|
||||
"Imate neshranjene spremembe. Ali jih želite shraniti?": "Your changes have not been saved. Do you want to save them?",
|
||||
"Ime": "First name",
|
||||
"IME": "FIRST NAME",
|
||||
|
||||
@@ -118,7 +118,6 @@
|
||||
"ID Slovarja": "ID Slovarja",
|
||||
"ID: Ni idja": "ID: Ni idja",
|
||||
"IDEKSIRAJ": "IDEKSIRAJ",
|
||||
"Imate neshranjene spremebe. Ali jih želite shraniti?": "Imate neshranjene spremebe. Ali jih želite shraniti?",
|
||||
"Imate neshranjene spremembe. Ali jih želite shraniti?": "Imate neshranjene spremembe. Ali jih želite shraniti?",
|
||||
"Ime": "Ime",
|
||||
"IME": "IME",
|
||||
|
||||
@@ -158,6 +158,10 @@ form#register-form {
|
||||
input {
|
||||
border: none;
|
||||
}
|
||||
|
||||
&.pt-6 {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@ const {
|
||||
updateStatus
|
||||
} = require('../../../controllers/api/v1/comments')
|
||||
|
||||
// TODO Add correct authorization for different contexts.
|
||||
|
||||
// List comments (one page).
|
||||
router.get('/', listComments)
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
// This page refers to dictionary entries, not consultancy or other entries
|
||||
const router = require('express-promise-router')()
|
||||
const user = require('../../../middleware/user')
|
||||
const {
|
||||
setDerivedDictionaryIdFromEntryId
|
||||
} = require('../../../middleware/index')
|
||||
|
||||
const {
|
||||
getEntry,
|
||||
@@ -12,7 +15,9 @@ const {
|
||||
} = require('../../../controllers/api/v1/dictionaries')
|
||||
|
||||
// All further routes are only available to authenticated users with dictionary content editing rights.
|
||||
router.use(user.isAuthenticated, user.canContentEdit)
|
||||
router.use(user.isAuthenticated)
|
||||
router.use('/delete-entry', setDerivedDictionaryIdFromEntryId)
|
||||
router.use(user.canContentEdit)
|
||||
|
||||
// Render entry data for the selected entry
|
||||
router.get('/', getEntry)
|
||||
|
||||
@@ -196,7 +196,12 @@ function updateDictionaries(done) {
|
||||
)
|
||||
},
|
||||
function (cbwd) {
|
||||
fetchUpdates(ldict, errd => {
|
||||
fetchUpdates(ldict, (errd, body) => {
|
||||
if (body && body.error)
|
||||
console.error(
|
||||
'skipping dictionary update due to ',
|
||||
body.error
|
||||
)
|
||||
cbwd(errd)
|
||||
})
|
||||
},
|
||||
@@ -304,7 +309,7 @@ function fetchUpdates(ldict, done) {
|
||||
if (error) return done(error)
|
||||
if (body.error) {
|
||||
// server side error message
|
||||
return done(body)
|
||||
return done(null, body)
|
||||
}
|
||||
// the body will contain decoded JSON array of dictionary items to update
|
||||
if (Array.isArray(body)) {
|
||||
|
||||
@@ -182,6 +182,18 @@
|
||||
.row.pt-1
|
||||
.col.pe-0
|
||||
p#error-password-repeat.mb-0.repeat.error-text.text-end= t('Geslo se ne ujema')
|
||||
//- Honeypot. Hidden by css selector form#register-form .row.pt-6.
|
||||
.row.pt-6
|
||||
.col-2.d-flex.align-items-center.justify-content-center.pe-4
|
||||
img(src="/images/user.svg" alt="")
|
||||
.col-8.input-floor.ps-0
|
||||
label.loginregisterlabel(for="register-user-tag") OZNAKA
|
||||
input#register-user-tag.w-100.input-lr(name="userTag")
|
||||
.col-2.input-floor.d-flex.justify-content-end.pe-0
|
||||
img.error-icon.error-user-tag.align-self-end.d-flex(
|
||||
src="/images/x_red.svg"
|
||||
alt="X"
|
||||
)
|
||||
.row.mt-1.pt-0
|
||||
.col-2.d-flex.align-items-center.justify-content-center.pe-4
|
||||
.col-8.ps-0
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
p Dear #{ username },
|
||||
p You have received this massage because a new user account has been created on the Slovenian Terminology Portal using this e-mail address.
|
||||
p To activate your account, you must confirm that this is the correct e-mail address. The link will be active for 7 days.
|
||||
p To activate your account, you must confirm that this is the correct e-mail address. The link will be active for 2 days.
|
||||
a(href=activationLink) I confirm my e-mail address.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
p Pozdravljeni #{ username },
|
||||
p to sporočilo ste prejeli, ker ste na Slovenskem terminološkem portalu registrirali nov uporabniški račun s tem elektronskim naslovom.
|
||||
p Za uporabo računa potrebujete le še potrditi, da je to res vaš elektronski naslov. Povezava je veljavna 7 dni.
|
||||
p Za uporabo računa potrebujete le še potrditi, da je to res vaš elektronski naslov. Povezava je veljavna 2 dni.
|
||||
a(href=activationLink) Potrjujem svoj naslov
|
||||
|
||||
@@ -82,4 +82,4 @@ block body
|
||||
|
||||
include /utilities/modal-alert
|
||||
include /utilities/modal-alert-mixin
|
||||
+alertModal('unsaved-data', t('Shrani'), t('Ne'), 'modal-save-btn', 'modal-dont-save-btn', t('Imate neshranjene spremebe. Ali jih želite shraniti?'))
|
||||
+alertModal('unsaved-data', t('Shrani'), t('Ne'), 'modal-save-btn', 'modal-dont-save-btn', t('Imate neshranjene spremembe. Ali jih želite shraniti?'))
|
||||
|
||||
@@ -18,4 +18,4 @@ block body
|
||||
+dictionary-description(dictionary.id)
|
||||
include /utilities/modal-alert
|
||||
include /utilities/modal-alert-mixin
|
||||
+alertModal('unsaved-data', t('Shrani'), t('Ne'), 'modal-save-btn', 'modal-dont-save-btn', t('Imate neshranjene spremebe. Ali jih želite shraniti?'))
|
||||
+alertModal('unsaved-data', t('Shrani'), t('Ne'), 'modal-save-btn', 'modal-dont-save-btn', t('Imate neshranjene spremembe. Ali jih želite shraniti?'))
|
||||
|
||||
@@ -20,4 +20,4 @@ block body
|
||||
include /utilities/dictionary-structure-input
|
||||
include /common/footer
|
||||
include /utilities/modal-alert-mixin
|
||||
+alertModal('unsaved-data', t('Shrani'), t('Ne'), 'modal-save-btn', 'modal-dont-save-btn', t('Imate neshranjene spremebe. Ali jih želite shraniti?'))
|
||||
+alertModal('unsaved-data', t('Shrani'), t('Ne'), 'modal-save-btn', 'modal-dont-save-btn', t('Imate neshranjene spremembe. Ali jih želite shraniti?'))
|
||||
|
||||
@@ -210,6 +210,7 @@ block body
|
||||
span.new-user-info= t('NOV UPORABNIK')
|
||||
.row.d-flex.justify-content-lg-start.align-items-center.mt-2.ms-0.ps-0
|
||||
.col-lg-6.ms-0.ps-0.me-2
|
||||
input(type="hidden" name="dictionaryId" value=dictionary.id)
|
||||
input.name-input.d-inline.form-control.ms-0.ps-0(
|
||||
type="text"
|
||||
name="userNameEmail"
|
||||
@@ -279,4 +280,4 @@ block body
|
||||
include /utilities/modal-response
|
||||
+responseModal
|
||||
include /utilities/modal-alert-mixin
|
||||
+alertModal('unsaved-data', 'Shrani', 'Ne', 'modal-save-btn', 'modal-dont-save-btn', 'Imate neshranjene spremebe. Ali jih želite shraniti?')
|
||||
+alertModal('unsaved-data', 'Shrani', 'Ne', 'modal-save-btn', 'modal-dont-save-btn', 'Imate neshranjene spremembe. Ali jih želite shraniti?')
|
||||
|
||||
@@ -78,4 +78,4 @@ block body
|
||||
span.d-md-inline.d-block.smaller-gray-info.ms-xxl-3.ms-md-3= t('Vnesite naslov spletnega mesta, kjer so zbrani vsi odgovori terminološke svetovalnice.')
|
||||
include /common/footer
|
||||
include /utilities/modal-alert-mixin
|
||||
+alertModal('unsaved-data', t('Shrani'), t('Ne'), 'modal-save-btn', 'modal-dont-save-btn', t('Imate neshranjene spremebe. Ali jih želite shraniti?'))
|
||||
+alertModal('unsaved-data', t('Shrani'), t('Ne'), 'modal-save-btn', 'modal-dont-save-btn', t('Imate neshranjene spremembe. Ali jih želite shraniti?'))
|
||||
|
||||
@@ -137,4 +137,4 @@ block body
|
||||
span.d-md-inline.d-block.smaller-gray-info= t('Modul za svetovanje pri terminoloških zagatah.')
|
||||
include /common/footer
|
||||
include /utilities/modal-alert-mixin
|
||||
+alertModal('unsaved-data', t('Shrani'), t('Ne'), 'modal-save-btn', 'modal-dont-save-btn', t('Imate neshranjene spremebe. Ali jih želite shraniti?'))
|
||||
+alertModal('unsaved-data', t('Shrani'), t('Ne'), 'modal-save-btn', 'modal-dont-save-btn', t('Imate neshranjene spremembe. Ali jih želite shraniti?'))
|
||||
|
||||
@@ -107,4 +107,4 @@ block body
|
||||
span.d-md-inline.d-block.smaller-gray-info.ms-md-2= t('Poleg objave slovarskega sestavka v fazi "Urejeno" je omogočena tudi objava v fazi "V urejanju".')
|
||||
include /common/footer
|
||||
include /utilities/modal-alert-mixin
|
||||
+alertModal('unsaved-data', t('Shrani'), t('Ne'), 'modal-save-btn', 'modal-dont-save-btn', t('Imate neshranjene spremebe. Ali jih želite shraniti?'))
|
||||
+alertModal('unsaved-data', t('Shrani'), t('Ne'), 'modal-save-btn', 'modal-dont-save-btn', t('Imate neshranjene spremembe. Ali jih želite shraniti?'))
|
||||
|
||||
@@ -111,4 +111,4 @@ block body
|
||||
include /utilities/modal-response
|
||||
+responseModal
|
||||
include /utilities/modal-alert-mixin
|
||||
+alertModal('unsaved-data', t('Shrani'), t('Ne'), 'modal-save-btn', 'modal-dont-save-btn', t('Imate neshranjene spremebe. Ali jih želite shraniti?'))
|
||||
+alertModal('unsaved-data', t('Shrani'), t('Ne'), 'modal-save-btn', 'modal-dont-save-btn', t('Imate neshranjene spremembe. Ali jih želite shraniti?'))
|
||||
|
||||
@@ -146,4 +146,4 @@ block body
|
||||
#offset-main.ps-2.pe-2
|
||||
p #{ t('Nimate ustreznih pravic') }
|
||||
include /utilities/modal-alert-mixin
|
||||
+alertModal('unsaved-data', 'Shrani', 'Ne', 'modal-save-btn', 'modal-dont-save-btn', t('Imate neshranjene spremebe. Ali jih želite shraniti?'))
|
||||
+alertModal('unsaved-data', 'Shrani', 'Ne', 'modal-save-btn', 'modal-dont-save-btn', t('Imate neshranjene spremembe. Ali jih želite shraniti?'))
|
||||
|
||||
@@ -18,4 +18,4 @@ block body
|
||||
+dictionary-description
|
||||
include /utilities/modal-alert
|
||||
include /utilities/modal-alert-mixin
|
||||
+alertModal('unsaved-data', t('Shrani'), t('Ne'), 'modal-save-btn', 'modal-dont-save-btn', t('Imate neshranjene spremebe. Ali jih želite shraniti?'))
|
||||
+alertModal('unsaved-data', t('Shrani'), t('Ne'), 'modal-save-btn', 'modal-dont-save-btn', t('Imate neshranjene spremembe. Ali jih želite shraniti?'))
|
||||
|
||||
@@ -20,4 +20,4 @@ block body
|
||||
include /utilities/dictionary-structure-input
|
||||
include /common/footer
|
||||
include /utilities/modal-alert-mixin
|
||||
+alertModal('unsaved-data', t('Shrani'), t('Ne'), 'modal-save-btn', 'modal-dont-save-btn', t('Imate neshranjene spremebe. Ali jih želite shraniti?'))
|
||||
+alertModal('unsaved-data', t('Shrani'), t('Ne'), 'modal-save-btn', 'modal-dont-save-btn', t('Imate neshranjene spremembe. Ali jih želite shraniti?'))
|
||||
|
||||
@@ -210,6 +210,7 @@ block body
|
||||
span.new-user-info= t('NOV UPORABNIK')
|
||||
.row.d-flex.justify-content-lg-start.align-items-center.mt-2.ms-0.ps-0
|
||||
.col-lg-6.ms-0.ps-0.me-2
|
||||
input(type="hidden" name="dictionaryId" value=dictionary.id)
|
||||
input.name-input.d-inline.form-control.ms-0.ps-0(
|
||||
type="text"
|
||||
name="userNameEmail"
|
||||
@@ -279,4 +280,4 @@ block body
|
||||
include /utilities/modal-response
|
||||
+responseModal
|
||||
include /utilities/modal-alert-mixin
|
||||
+alertModal('unsaved-data', t('Shrani'), t('Ne'), 'modal-save-btn', 'modal-dont-save-btn', t('Imate neshranjene spremebe. Ali jih želite shraniti?'))
|
||||
+alertModal('unsaved-data', t('Shrani'), t('Ne'), 'modal-save-btn', 'modal-dont-save-btn', t('Imate neshranjene spremembe. Ali jih želite shraniti?'))
|
||||
|
||||
@@ -89,4 +89,4 @@ mixin dictionary-domain-labels
|
||||
include /common/footer
|
||||
include /utilities/modal-alert
|
||||
include /utilities/modal-alert-mixin
|
||||
+alertModal('unsaved-data', t('Shrani'), t('Ne'), 'modal-save-btn', 'modal-dont-save-btn', t('Imate neshranjene spremebe. Ali jih želite shraniti?'))
|
||||
+alertModal('unsaved-data', t('Shrani'), t('Ne'), 'modal-save-btn', 'modal-dont-save-btn', t('Imate neshranjene spremembe. Ali jih želite shraniti?'))
|
||||
|
||||
Reference in New Issue
Block a user