Made several changes: - added viewing OTP backup tokens for admins - added admin access to author dashboard and editing posts not in admin area - removed canAuthorPages and can canPublishPages from hasAuthorDashboard - added admin editing and deletion of posts from the post page - redirect after post deletion to home page - added author of post when viewing posts as publisher and admin on Author Dashboard and admin post viewmaster
@ -0,0 +1,60 @@
|
||||
// admin/otp.js
|
||||
// Copyright (C) 2021 Digital Telepresence, LLC
|
||||
// License: Apache-2.0
|
||||
|
||||
'use strict';
|
||||
|
||||
const express = require('express');
|
||||
// const multer = require('multer');
|
||||
|
||||
const { SiteController, SiteError } = require('../../../lib/site-lib');
|
||||
|
||||
class OtpAdminController extends SiteController {
|
||||
|
||||
constructor (dtp) {
|
||||
super(dtp, module.exports);
|
||||
dtp.log.debug("OTP controller started");
|
||||
}
|
||||
|
||||
async start ( ) {
|
||||
// const upload = multer({ dest: `/tmp/${this.dtp.config.site.domainKey}/uploads/${module.exports.slug}` });
|
||||
|
||||
const router = express.Router();
|
||||
router.use(async (req, res, next) => {
|
||||
res.locals.currentView = 'admin';
|
||||
res.locals.adminView = 'otp';
|
||||
return next();
|
||||
});
|
||||
|
||||
// router.param('otp', this.populateOtp.bind(this));
|
||||
|
||||
|
||||
|
||||
router.get('/', this.getIndex.bind(this));
|
||||
|
||||
// router.delete('/:postId', this.deletePost.bind(this));
|
||||
|
||||
return router;
|
||||
}
|
||||
|
||||
async getIndex (req, res, next) {
|
||||
try {
|
||||
const { otpAuth: otpAuthService } = this.dtp.services;
|
||||
if (!req.user) {
|
||||
throw new SiteError(402, "Error getting user");
|
||||
}
|
||||
res.locals.tokens = await otpAuthService.getBackupTokens(req.user, "Admin");
|
||||
res.render('admin/otp/index');
|
||||
} catch (error) {
|
||||
this.log.error('failed to get tokens', { error });
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
name: 'adminOtp',
|
||||
slug: 'admin-opt',
|
||||
create: async (dtp) => { return new OtpAdminController(dtp); },
|
||||
};
|
@ -0,0 +1,9 @@
|
||||
extends ../layouts/main
|
||||
block content
|
||||
|
||||
div(uk-grid)
|
||||
.uk-width-expand
|
||||
h1 Tokens
|
||||
|
||||
each token of tokens
|
||||
p #{token.token}
|
@ -1,5 +1,5 @@
|
||||
block twitter-card
|
||||
meta(name='twitter:card', content='summary_large_image')
|
||||
meta(name='twitter:image' content= `https://${site.domain}/img/social-cards/${site.domainKey}.png?v=${pkg.version}`)
|
||||
meta(name='twitter:image' content= shareImage || `https://${site.domain}/img/social-cards/${site.domainKey}.png?v=${pkg.version}`)
|
||||
meta(name='twitter:title', content= pageTitle || site.name)
|
||||
meta(name='twitter:description', content= pageDescription || site.description)
|
||||
|
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 436 B |
After Width: | Height: | Size: 4.8 KiB |
After Width: | Height: | Size: 5.2 KiB |
After Width: | Height: | Size: 7.7 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 803 B |
After Width: | Height: | Size: 919 B |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 20 KiB |