Implement email config
This commit is contained in:
parent
0ce64f8c33
commit
1bc109b42c
10 changed files with 280 additions and 13 deletions
|
|
@ -20,6 +20,7 @@ import config from '../config';
|
|||
import networkChart from '../chart/network';
|
||||
import apiServer from './api';
|
||||
import { sum } from '../prelude/array';
|
||||
import User from '../models/user';
|
||||
|
||||
// Init app
|
||||
const app = new Koa();
|
||||
|
|
@ -59,6 +60,24 @@ const router = new Router();
|
|||
router.use(activityPub.routes());
|
||||
router.use(webFinger.routes());
|
||||
|
||||
router.get('/verify-email/:code', async ctx => {
|
||||
const user = await User.findOne({ emailVerifyCode: ctx.params.code });
|
||||
|
||||
if (user != null) {
|
||||
ctx.body = 'Verify succeeded!';
|
||||
ctx.status = 200;
|
||||
|
||||
User.update({ _id: user._id }, {
|
||||
$set: {
|
||||
emailVerified: true,
|
||||
emailVerifyCode: null
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ctx.status = 404;
|
||||
}
|
||||
});
|
||||
|
||||
// Return 404 for other .well-known
|
||||
router.all('/.well-known/*', async ctx => {
|
||||
ctx.status = 404;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue