This commit is contained in:
syuilo 2018-06-16 10:40:53 +09:00
parent f164661ef2
commit e11f547308
8 changed files with 102 additions and 22 deletions

View file

@ -5,6 +5,7 @@ import recaptcha = require('recaptcha-promise');
import User, { IUser, validateUsername, validatePassword, pack } from '../../../models/user';
import generateUserToken from '../common/generate-native-user-token';
import config from '../../../config';
import Meta from '../../../models/meta';
recaptcha.init({
secret_key: config.recaptcha.secret_key
@ -93,6 +94,15 @@ export default async (ctx: Koa.Context) => {
}
});
//#region Increment users count
Meta.update({}, {
$inc: {
'stats.usersCount': 1,
'stats.originalUsersCount': 1
}
}, { upsert: true });
//#endregion
// Response
ctx.body = await pack(account);
};