From 02c6d2a3f7d0261aa5064aa810266374af5a9200 Mon Sep 17 00:00:00 2001 From: klimashkin Date: Wed, 24 Jul 2013 21:19:40 +0400 Subject: [PATCH] =?UTF-8?q?=D0=92=D1=8B=D0=B1=D0=BE=D1=80=20=D0=BE=D1=82?= =?UTF-8?q?=D0=BE=D0=B1=D1=80=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B8?= =?UTF-8?q?=D0=BC=D0=B5=D0=BD=D0=B8=204.=20=D0=9F=D1=80=D0=B8=20=D1=81?= =?UTF-8?q?=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD=D0=B8=D0=B8=20=D0=BF=D0=BE=D0=BB?= =?UTF-8?q?=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8F=20=D0=BF?= =?UTF-8?q?=D0=BE=20=D0=B4=D0=B5=D1=84=D0=BE=D0=BB=D1=82=D1=83=20disp=20?= =?UTF-8?q?=D0=BF=D1=80=D0=B8=D0=BD=D0=B8=D0=BC=D0=B0=D0=B5=D0=BC=20=D0=B7?= =?UTF-8?q?=D0=B0=20=D0=BB=D0=BE=D0=B3=D0=B8=D0=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/auth.js | 21 ++++++++------------- public/js/model/User.js | 2 ++ public/js/module/common/auth.js | 2 +- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/controllers/auth.js b/controllers/auth.js index d10107ed8..7aff5aafa 100755 --- a/controllers/auth.js +++ b/controllers/auth.js @@ -83,8 +83,7 @@ function register(session, data, cb) { if (!data.pass) error += 'Fill in the password field. '; if (data.pass !== data.pass2) error += 'Passwords do not match.'; if (error) { - cb({message: error, error: true}); - return; + return cb({message: error, error: true}); } Step( @@ -102,19 +101,16 @@ function register(session, data, cb) { if (user.email === data.email) { error += 'User with such email already exists.'; } - cb({message: error, error: true}); - return; + return cb({message: error, error: true}); } Counter.increment('user', this.parallel()); }, function createUser(err, count) { if (err) { - cb({message: err, error: true}); - return; + return cb({message: err, error: true}); } if (!count) { - cb({message: 'Increment user counter error', error: true}); - return; + return cb({message: 'Increment user counter error', error: true}); } confirmKey = Utils.randomString(7); @@ -122,7 +118,8 @@ function register(session, data, cb) { login: data.login, cid: count.next, email: data.email, - pass: data.pass + pass: data.pass, + disp: data.login }); newUser.save(this.parallel()); @@ -130,8 +127,7 @@ function register(session, data, cb) { }, function sendMail(err, user) { if (err) { - cb({message: err.message, error: true}); - return; + return cb({message: err.message, error: true}); } new UserConfirm({key: confirmKey, user: user._id}).save(this.parallel()); @@ -162,8 +158,7 @@ function register(session, data, cb) { function finish(err) { if (err) { - cb({message: err.message, error: true}); - return; + return cb({message: err.message, error: true}); } cb({message: success}); } diff --git a/public/js/model/User.js b/public/js/model/User.js index 06a840ba2..195f650e5 100644 --- a/public/js/model/User.js +++ b/public/js/model/User.js @@ -12,6 +12,8 @@ define(['jquery', 'underscore', 'knockout', 'knockout.mapping', 'Params'], funct }, full: { email: '', + firstName: '', + lastName: '', //role role: 0, diff --git a/public/js/module/common/auth.js b/public/js/module/common/auth.js index 1b41f5d3d..6de76234f 100644 --- a/public/js/module/common/auth.js +++ b/public/js/module/common/auth.js @@ -58,7 +58,7 @@ define(['jquery', 'Utils', '../../socket', 'Params', 'knockout', 'm/_moduleClich showPassChangeRecall: function (data, key, callback, ctx) { this.login(data.login); - this.name(data.name); + this.name(data.disp); this.avatar(data.avatar); this.key(key); this.show('passChangeRecall', callback, ctx);