fix email sign should not require username

This commit is contained in:
Berkeley Martinez
2015-08-05 19:29:17 -07:00
parent a838a4097d
commit 0ce81bbabb
2 changed files with 6 additions and 19 deletions

View File

@ -1,4 +1,5 @@
import { Observable } from 'rx';
import uuid from 'node-uuid';
import moment from 'moment';
import debugFactory from 'debug';
@ -62,6 +63,11 @@ module.exports = function(User) {
ctx.res.redirect('/email-signin');
});
User.beforeRemote('create', function({ req }, notUsed, next) {
req.body.username = 'fcc' + uuid.v4().slice(0, 8);
next();
});
User.afterRemote('login', function(ctx, user, next) {
var res = ctx.res;
var req = ctx.req;