add support for logging in from register page

This commit is contained in:
ansuz
2017-03-14 12:39:22 +01:00
parent 11ff3f5347
commit 09afba80db
2 changed files with 44 additions and 22 deletions

View File

@@ -94,17 +94,21 @@ define([
res.realtime = rt.realtime;
res.network = rt.network;
// they're registering...
res.userHash = opt.userHash;
res.userName = uname;
// they tried to just log in but there's no such user
if (!isRegister && isProxyEmpty(rt.proxy)) {
rt.network.disconnect(); // clean up after yourself
return void cb('NO_SUCH_USER', res);
}
// they're registering...
res.userHash = opt.userHash;
res.userName = uname;
//res.displayName // TODO
// they tried to register, but those exact credentials exist
if (isRegister && !isProxyEmpty(rt.proxy)) {
rt.network.disconnect();
return void cb('ALREADY_REGISTERED', res);
}
cb(void 0, res);
});