clean up registration code a little bit

pull/1/head
ansuz 8 years ago
parent c3c866fa2b
commit b578803136

@ -108,6 +108,8 @@ define([
Cryptpad.addLoadingScreen(Messages.login_hashing); Cryptpad.addLoadingScreen(Messages.login_hashing);
Login.loginOrRegister(uname, passwd, true, function (err, result) { Login.loginOrRegister(uname, passwd, true, function (err, result) {
var proxy = result.proxy;
if (err) { if (err) {
switch (err) { switch (err) {
case 'NO_SUCH_USER': case 'NO_SUCH_USER':
@ -129,10 +131,10 @@ define([
Cryptpad.removeLoadingScreen(function () { Cryptpad.removeLoadingScreen(function () {
Cryptpad.confirm(Messages.register_alreadyRegistered, function (yes) { Cryptpad.confirm(Messages.register_alreadyRegistered, function (yes) {
if (!yes) { return; } if (!yes) { return; }
result.proxy.login_name = uname; proxy.login_name = uname;
if (!result.proxy[Cryptpad.displayNameKey]) { if (!proxy[Cryptpad.displayNameKey]) {
result.proxy[Cryptpad.displayNameKey] = uname; proxy[Cryptpad.displayNameKey] = uname;
} }
Cryptpad.eraseTempSessionValues(); Cryptpad.eraseTempSessionValues();
logMeIn(result); logMeIn(result);
@ -144,8 +146,6 @@ define([
} }
return; return;
} }
var proxy = result.proxy;
Cryptpad.eraseTempSessionValues(); Cryptpad.eraseTempSessionValues();
if (shouldImport) { if (shouldImport) {
sessionStorage.migrateAnonDrive = 1; sessionStorage.migrateAnonDrive = 1;
@ -158,8 +158,8 @@ define([
logMeIn(result); logMeIn(result);
}); });
}, { }, {
ok: Messages.register_writtenPassword, //'I have written down my password, proceed', ok: Messages.register_writtenPassword,
cancel: Messages.register_cancel, // 'Go back', cancel: Messages.register_cancel,
cancelClass: 'safe', cancelClass: 'safe',
okClass: 'danger', okClass: 'danger',
reverseOrder: true, reverseOrder: true,

Loading…
Cancel
Save