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;

View File

@ -19,25 +19,6 @@ block content
alert(type='danger')
span.ion-close-circled
| That email address is already in use.
.form-group
.col-sm-6.col-sm-offset-3
input.form-control(type='text', name='username', ng-keypress='', autocomplete="off", id='username', placeholder='username', ng-model='username', unique-username='', required, ng-minlength=5, ng-maxlength=20, ng-pattern="/^[A-z0-9_]+$/")
.col-sm-6.col-sm-offset-3(ng-cloak, ng-show="profileForm.username.$error.pattern && !signupForm.username.$pristine")
alert(type='danger')
span.ion-close-circled
| Your username should only contain letters, numbers and underscores (az10_).
.col-sm-6.col-sm-offset-3(ng-cloak, ng-show="signupForm.username.$error.unique && !signupForm.username.$pristine")
alert(type='danger')
span.ion-close-circled
| This username is taken.
.col-sm-6.col-sm-offset-3(ng-cloak, ng-show="signupForm.username.$error.minlength && !signupForm.username.$pristine")
alert(type='danger')
span.ion-close-circled
| Your username must be at least 5 characters long.
.col-sm-6.col-sm-offset-3(ng-cloak, ng-show="signupForm.username.$error.maxlength && !signupForm.username.$pristine")
alert(type='danger')
span.ion-close-circled
| Your usernames must be 20 characters or fewer.
.form-group
.col-sm-6.col-sm-offset-3
input.form-control(type='password', ng-model='password', name='password', id='password', placeholder='password', required, ng-minlength=8)