This commit is contained in:
syuilo
2017-08-28 23:47:43 +09:00
parent f546edb810
commit ffaec0b971
14 changed files with 137 additions and 33 deletions

View File

@ -1,10 +1,10 @@
import * as express from 'express';
import * as bcrypt from 'bcryptjs';
import rndstr from 'rndstr';
import recaptcha = require('recaptcha-promise');
import User from '../models/user';
import { validateUsername, validatePassword } from '../models/user';
import serialize from '../serializers/user';
import generateUserToken from '../common/generate-native-user-token';
import config from '../../conf';
recaptcha.init({
@ -58,7 +58,7 @@ export default async (req: express.Request, res: express.Response) => {
const hash = bcrypt.hashSync(password, salt);
// Generate secret
const secret = `!${rndstr('a-zA-Z0-9', 32)}`;
const secret = generateUserToken();
// Create account
const account = await User.insert({