Add views for key search result, verify success and removal success pages.
This commit is contained in:
parent
f399da9614
commit
ff6f9f7c63
@ -2,7 +2,9 @@
|
|||||||
"key_not_found": "Schlüssel nicht gefunden",
|
"key_not_found": "Schlüssel nicht gefunden",
|
||||||
"verify_key_subject": "Bestätigen Sie Ihre E-Mail-Adresse",
|
"verify_key_subject": "Bestätigen Sie Ihre E-Mail-Adresse",
|
||||||
"verify_key_text": "Hallo {0},\n\nbitte bestätigen Sie Ihre E-Mail-Adresse {1}.\nKlicken Sie hierzu auf den folgenden Link:\n\n{2}\n\nNach der Bestätigung Ihrer E-Mail-Adresse ist ihr öffentlicher Schlüssel in unserem Schlüssel Verzeichnis verfügbar.\n\nWeitere Informationen finden Sie unter {3}.\n\nIhr Mailvelope Team",
|
"verify_key_text": "Hallo {0},\n\nbitte bestätigen Sie Ihre E-Mail-Adresse {1}.\nKlicken Sie hierzu auf den folgenden Link:\n\n{2}\n\nNach der Bestätigung Ihrer E-Mail-Adresse ist ihr öffentlicher Schlüssel in unserem Schlüssel Verzeichnis verfügbar.\n\nWeitere Informationen finden Sie unter {3}.\n\nIhr Mailvelope Team",
|
||||||
"verify_success": "<h1>Mailvelope Key Server keys.mailvelope.com</h1><h2>E-Mail Adresse {0} erfolgreich verifiziert!</h2><p>Ihr öffentlicher OpenPGP Schlüssel ist ab jetzt unter folgendem Link verfügbar: <a href=\"{1}\" target=\"_blank\">{1}</a></p>",
|
"verify_success_header": "E-Mail Adresse {0} erfolgreich verifiziert",
|
||||||
|
"verify_success_link": "Ihr öffentlicher OpenPGP Schlüssel ist ab jetzt unter folgendem Link verfügbar:",
|
||||||
"verify_removal_subject": "Entfernen Ihres Schlüssels bestätigen",
|
"verify_removal_subject": "Entfernen Ihres Schlüssels bestätigen",
|
||||||
"verify_removal_text": "Hallo {0},\n\nbitte bestätigen Sie das Entfernen Ihrer E-Mail-Adresse {1} von unserem Key Server ({2}).\nKlicken Sie hierzu auf den folgenden Link:\n\n{3}\n\nIhr Mailvelope Team"
|
"verify_removal_text": "Hallo {0},\n\nbitte bestätigen Sie das Entfernen Ihrer E-Mail-Adresse {1} von unserem Key Server ({2}).\nKlicken Sie hierzu auf den folgenden Link:\n\n{3}\n\nIhr Mailvelope Team",
|
||||||
|
"removal_success": "E-Mail Adresse {0} aus dem Schlüssel Verzeichnis entfernt"
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
{
|
{
|
||||||
"key_not_found": "Key not found",
|
"key_not_found": "Key not found",
|
||||||
"verify_key_subject": "Verify your email address",
|
"verify_key_subject": "Verify your email address",
|
||||||
"verify_key_text": "Hello {0},\n\nplease verify your email address {1} by clicking on the following link:\n\n{2}\n\nAfter verification of your email address your public key is available in our key directory.\n\nYou can find more info at {3}.\n\nGreetings from the Mailvelope Team",
|
"verify_key_text": "Hello {0},\n\nplease verify your email address {1} by clicking on the following link:\n\n{2}\n\nAfter verification of your email address, your public key is available in our key directory.\n\nYou can find more info at {3}.\n\nGreetings from the Mailvelope Team",
|
||||||
"verify_success": "<h1>Mailvelope Key Server keys.mailvelope.com</h1><h2>Email address {0} successfully verified!</h2><p>Your public OpenPGP key is now available at the following link: <a href=\"{1}\" target=\"_blank\">{1}</a></p>",
|
"verify_success_header": "Email address {0} successfully verified",
|
||||||
|
"verify_success_link": "Your public OpenPGP key is now available at the following link:",
|
||||||
"verify_removal_subject": "Verify key removal",
|
"verify_removal_subject": "Verify key removal",
|
||||||
"verify_removal_text": "Hello {0},\n\nplease verify removal of your email address {1} from our key server ({2}) by clicking on the following link:\n\n{3}\n\nGreetings from the Mailvelope Team"
|
"verify_removal_text": "Hello {0},\n\nplease verify removal of your email address {1} from our key server ({2}) by clicking on the following link:\n\n{3}\n\nGreetings from the Mailvelope Team",
|
||||||
|
"removal_success": "Email address {0} removed from the key directory"
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ const router = require('koa-router')();
|
|||||||
const render = require('koa-ejs');
|
const render = require('koa-ejs');
|
||||||
const locales = require('koa-locales');
|
const locales = require('koa-locales');
|
||||||
const config = require('config');
|
const config = require('config');
|
||||||
|
const path = require('path');
|
||||||
const middleware = require('./middleware');
|
const middleware = require('./middleware');
|
||||||
const Mongo = require('../dao/mongo');
|
const Mongo = require('../dao/mongo');
|
||||||
const Email = require('../email/email');
|
const Email = require('../email/email');
|
||||||
@ -32,14 +33,22 @@ const PGP = require('../service/pgp');
|
|||||||
const PublicKey = require('../service/public-key');
|
const PublicKey = require('../service/public-key');
|
||||||
|
|
||||||
const app = new Koa();
|
const app = new Koa();
|
||||||
|
|
||||||
render(app, {
|
render(app, {
|
||||||
root: `${__dirname}/../view`
|
root: path.join(__dirname, '../view')
|
||||||
});
|
});
|
||||||
|
|
||||||
locales(app);
|
locales(app);
|
||||||
|
|
||||||
let hkp;
|
let hkp;
|
||||||
let rest;
|
let rest;
|
||||||
|
|
||||||
|
app.use(async (ctx, next) => {
|
||||||
|
ctx.state = ctx.state || {};
|
||||||
|
ctx.state.__ = ctx.__.bind(ctx);
|
||||||
|
await next();
|
||||||
|
});
|
||||||
|
|
||||||
// UI views
|
// UI views
|
||||||
router.get('/', ctx => ctx.render('index'));
|
router.get('/', ctx => ctx.render('index'));
|
||||||
router.redirect('/index.html', '/');
|
router.redirect('/index.html', '/');
|
||||||
@ -58,7 +67,7 @@ app.use(middleware.upgradeToHTTPS);
|
|||||||
app.use(middleware.setHTTPResponseHeaders);
|
app.use(middleware.setHTTPResponseHeaders);
|
||||||
app.use(router.routes());
|
app.use(router.routes());
|
||||||
app.use(router.allowedMethods());
|
app.use(router.allowedMethods());
|
||||||
app.use(serve(`${__dirname}/../static`));
|
app.use(serve(path.join(__dirname, '../static')));
|
||||||
|
|
||||||
async function init() {
|
async function init() {
|
||||||
// inject dependencies
|
// inject dependencies
|
||||||
|
@ -56,7 +56,7 @@ class HKP {
|
|||||||
const params = this.parseQueryString(ctx);
|
const params = this.parseQueryString(ctx);
|
||||||
const key = await this._publicKey.get(params, ctx);
|
const key = await this._publicKey.get(params, ctx);
|
||||||
this.setGetHeaders(ctx, params);
|
this.setGetHeaders(ctx, params);
|
||||||
this.setGetBody(ctx, params, key);
|
await this.setGetBody(ctx, params, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -119,9 +119,13 @@ class HKP {
|
|||||||
* @param {Object} params The parsed query string parameters
|
* @param {Object} params The parsed query string parameters
|
||||||
* @param {Object} key The public key document
|
* @param {Object} key The public key document
|
||||||
*/
|
*/
|
||||||
setGetBody(ctx, params, key) {
|
async setGetBody(ctx, params, key) {
|
||||||
if (params.op === 'get') {
|
if (params.op === 'get') {
|
||||||
ctx.body = key.publicKeyArmored;
|
if (params.mr) {
|
||||||
|
ctx.body = key.publicKeyArmored;
|
||||||
|
} else {
|
||||||
|
await ctx.render('key-armored', {query: params, key});
|
||||||
|
}
|
||||||
} else if (['index', 'vindex'].indexOf(params.op) !== -1) {
|
} else if (['index', 'vindex'].indexOf(params.op) !== -1) {
|
||||||
const VERSION = 1;
|
const VERSION = 1;
|
||||||
const COUNT = 1; // number of keys
|
const COUNT = 1; // number of keys
|
||||||
|
@ -62,7 +62,7 @@ class REST {
|
|||||||
if (!util.isKeyId(q.keyId) && !util.isFingerPrint(q.fingerprint) && !util.isEmail(q.email)) {
|
if (!util.isKeyId(q.keyId) && !util.isFingerPrint(q.fingerprint) && !util.isEmail(q.email)) {
|
||||||
ctx.throw(400, 'Invalid request!');
|
ctx.throw(400, 'Invalid request!');
|
||||||
}
|
}
|
||||||
ctx.body = await this._publicKey.get(q, ctx);
|
await ctx.render('key-armored', {query: q, key: await this._publicKey.get(q, ctx)});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -77,8 +77,7 @@ class REST {
|
|||||||
const {email} = await this._publicKey.verify(q);
|
const {email} = await this._publicKey.verify(q);
|
||||||
// create link for sharing
|
// create link for sharing
|
||||||
const link = util.url(util.origin(ctx), `/pks/lookup?op=get&search=${email}`);
|
const link = util.url(util.origin(ctx), `/pks/lookup?op=get&search=${email}`);
|
||||||
ctx.body = ctx.__('verify_success', [email, link]);
|
await ctx.render('verify-success', {email, link});
|
||||||
ctx.set('Content-Type', 'text/html; charset=utf-8');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -104,8 +103,8 @@ class REST {
|
|||||||
if (!util.isKeyId(q.keyId) || !util.isString(q.nonce)) {
|
if (!util.isKeyId(q.keyId) || !util.isString(q.nonce)) {
|
||||||
ctx.throw(400, 'Invalid request!');
|
ctx.throw(400, 'Invalid request!');
|
||||||
}
|
}
|
||||||
await this._publicKey.verifyRemove(q);
|
const {email} = await this._publicKey.verifyRemove(q);
|
||||||
ctx.body = 'Email address successfully removed!';
|
await ctx.render('removal-success', {email});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -378,7 +378,8 @@ class PublicKey {
|
|||||||
}
|
}
|
||||||
if (flagged.userIds.length === 1) {
|
if (flagged.userIds.length === 1) {
|
||||||
// delete the key
|
// delete the key
|
||||||
return this._mongo.remove({keyId}, DB_TYPE);
|
await this._mongo.remove({keyId}, DB_TYPE);
|
||||||
|
return flagged.userIds[0];
|
||||||
}
|
}
|
||||||
// update the key
|
// update the key
|
||||||
const rmIdx = flagged.userIds.findIndex(userId => userId.nonce === nonce);
|
const rmIdx = flagged.userIds.findIndex(userId => userId.nonce === nonce);
|
||||||
@ -392,6 +393,7 @@ class PublicKey {
|
|||||||
}
|
}
|
||||||
flagged.userIds.splice(rmIdx, 1);
|
flagged.userIds.splice(rmIdx, 1);
|
||||||
await this._mongo.update({keyId}, flagged, DB_TYPE);
|
await this._mongo.update({keyId}, flagged, DB_TYPE);
|
||||||
|
return rmUserId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
9
src/view/footer.html
Normal file
9
src/view/footer.html
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<footer class="footer">
|
||||||
|
<nav>
|
||||||
|
<ul>
|
||||||
|
<li><a target="_blank" href="https://www.mailvelope.com/imprint">Imprint</a></li> |
|
||||||
|
<li><a target="_blank" href="https://www.mailvelope.com/privacy-service">Privacy</a></li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<p>© 2019 Mailvelope GmbH</p>
|
||||||
|
</footer>
|
@ -4,7 +4,7 @@
|
|||||||
<nav>
|
<nav>
|
||||||
<ul class="nav nav-pills pull-right">
|
<ul class="nav nav-pills pull-right">
|
||||||
<li role="presentation" class="active"><a href="/">Home</a></li>
|
<li role="presentation" class="active"><a href="/">Home</a></li>
|
||||||
<li role="presentation"><a href="manage.html">Manage Keys</a></li>
|
<li role="presentation"><a href="/manage.html">Manage Keys</a></li>
|
||||||
<li role="presentation"><a href="https://github.com/mailvelope/keyserver" target="_blank">GitHub</a></li>
|
<li role="presentation"><a href="https://github.com/mailvelope/keyserver" target="_blank">GitHub</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
@ -41,14 +41,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<footer class="footer">
|
<%- include('footer') %>
|
||||||
<nav>
|
|
||||||
<ul>
|
|
||||||
<li><a target="_blank" href="https://www.mailvelope.com/imprint">Imprint</a></li> |
|
|
||||||
<li><a target="_blank" href="https://www.mailvelope.com/privacy-service">Privacy</a></li>
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
<p>© 2019 Mailvelope GmbH</p>
|
|
||||||
</footer>
|
|
||||||
|
|
||||||
</div> <!-- /container -->
|
</div> <!-- /container -->
|
||||||
|
23
src/view/key-armored.html
Normal file
23
src/view/key-armored.html
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<div class="container">
|
||||||
|
|
||||||
|
<div class="header clearfix">
|
||||||
|
<nav>
|
||||||
|
<ul class="nav nav-pills pull-right">
|
||||||
|
<li role="presentation"><a href="/">Home</a></li>
|
||||||
|
<li role="presentation"><a href="/manage.html">Manage Keys</a></li>
|
||||||
|
<li role="presentation"><a href="https://github.com/mailvelope/keyserver" target="_blank">GitHub</a></li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<h3 class="text-muted">Mailvelope Key Server</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row marketing">
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<h4><%= query.email ? `Email: ${query.email}` : query.fingerprint ? `Fingerprint: ${query.fingerprint}` : `Key ID: ${query.keyId}` %></h4>
|
||||||
|
<pre><%= key.publicKeyArmored %></pre>
|
||||||
|
</div> <!-- /col-lg-12 -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<%- include('footer') %>
|
||||||
|
|
||||||
|
</div> <!-- /container -->
|
@ -6,8 +6,8 @@
|
|||||||
<meta name="description" content="An OpenPGP public key server that verifies users by sending an encrypted verification email.">
|
<meta name="description" content="An OpenPGP public key server that verifies users by sending an encrypted verification email.">
|
||||||
<meta name="author" content="Mailvelope GmbH">
|
<meta name="author" content="Mailvelope GmbH">
|
||||||
<title>Mailvelope Key Server</title>
|
<title>Mailvelope Key Server</title>
|
||||||
<link rel="stylesheet" href="css/bootstrap.min.css">
|
<link rel="stylesheet" href="/css/bootstrap.min.css">
|
||||||
<link rel="stylesheet" href="css/jumbotron-narrow.css">
|
<link rel="stylesheet" href="/css/jumbotron-narrow.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<%- body %>
|
<%- body %>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<nav>
|
<nav>
|
||||||
<ul class="nav nav-pills pull-right">
|
<ul class="nav nav-pills pull-right">
|
||||||
<li role="presentation"><a href="/">Home</a></li>
|
<li role="presentation"><a href="/">Home</a></li>
|
||||||
<li role="presentation" class="active"><a href="manage.html">Manage Keys</a></li>
|
<li role="presentation" class="active"><a href="/manage.html">Manage Keys</a></li>
|
||||||
<li role="presentation"><a href="https://github.com/mailvelope/keyserver" target="_blank">GitHub</a></li>
|
<li role="presentation"><a href="https://github.com/mailvelope/keyserver" target="_blank">GitHub</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
@ -72,15 +72,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div> <!-- /row marketing -->
|
</div> <!-- /row marketing -->
|
||||||
|
|
||||||
<footer class="footer">
|
<%- include('footer') %>
|
||||||
<nav>
|
|
||||||
<ul>
|
|
||||||
<li><a target="_blank" href="https://www.mailvelope.com/imprint">Imprint</a></li> |
|
|
||||||
<li><a target="_blank" href="https://www.mailvelope.com/privacy-service">Privacy</a></li>
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
<p>© 2019 Mailvelope GmbH</p>
|
|
||||||
</footer>
|
|
||||||
|
|
||||||
</div> <!-- /container -->
|
</div> <!-- /container -->
|
||||||
|
|
||||||
|
15
src/view/removal-success.html
Normal file
15
src/view/removal-success.html
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<div class="container">
|
||||||
|
|
||||||
|
<div class="header clearfix">
|
||||||
|
<h3 class="text-muted">Mailvelope Key Server</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row marketing">
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<h3><%= __('removal_success', [email]) %></h3>
|
||||||
|
</div> <!-- /col-lg-12 -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<%- include('footer') %>
|
||||||
|
|
||||||
|
</div> <!-- /container -->
|
16
src/view/verify-success.html
Normal file
16
src/view/verify-success.html
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<div class="container">
|
||||||
|
|
||||||
|
<div class="header clearfix">
|
||||||
|
<h3 class="text-muted">Mailvelope Key Server</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row marketing">
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<h3><%= __('verify_success_header', [email]) %></h3>
|
||||||
|
<p><%= __('verify_success_link') %> <a href="<%= link %>" target="_blank"><%= link %></a></p>
|
||||||
|
</div> <!-- /col-lg-12 -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<%- include('footer') %>
|
||||||
|
|
||||||
|
</div> <!-- /container -->
|
Loading…
Reference in New Issue
Block a user