Merge branch 'staging' of github.com:xwiki-labs/cryptpad into staging

pull/1/head
yflory 8 years ago
commit b1b294aade

@ -44,6 +44,18 @@ define([
return; return;
}; };
var whenRealtimeSyncs = common.whenRealtimeSyncs = function (realtime, cb) {
realtime.sync();
var interval = 300;
var check = function () {
if (realtime.getAuthDoc() !== realtime.getUserDoc()) {
return window.setTimeout(check, interval);
}
cb();
};
window.setTimeout(check, interval);
};
var getWebsocketURL = common.getWebsocketURL = function () { var getWebsocketURL = common.getWebsocketURL = function () {
if (!Config.websocketPath) { return Config.websocketURL; } if (!Config.websocketPath) { return Config.websocketURL; }
var path = Config.websocketPath; var path = Config.websocketPath;

@ -70,6 +70,9 @@ define([
Exports.loginOrRegister = function (uname, passwd, isRegister, cb) { Exports.loginOrRegister = function (uname, passwd, isRegister, cb) {
if (typeof(cb) !== 'function') { return; } if (typeof(cb) !== 'function') { return; }
// Usernames are all lowercase. No going back on this one
uname = uname.toLowerCase();
// validate inputs // validate inputs
if (!Cred.isValidUsername(uname)) { return void cb('INVAL_USER'); } if (!Cred.isValidUsername(uname)) { return void cb('INVAL_USER'); }
if (!Cred.isValidPassword(passwd)) { return void cb('INVAL_PASS'); } if (!Cred.isValidPassword(passwd)) { return void cb('INVAL_PASS'); }

@ -465,10 +465,10 @@ define([
window.location.href = '/'; window.location.href = '/';
}); });
$userAdmin.find('a.login').click(function (e) { $userAdmin.find('a.login').click(function (e) {
window.open('/user'); window.location.href = '/login/';
}); });
$userAdmin.find('a.register').click(function (e) { $userAdmin.find('a.register').click(function (e) {
window.open('/register/'); window.location.href = '/register/';
}); });
if (config.userName && config.userName.setName && config.userName.lastName) { if (config.userName && config.userName.setName && config.userName.lastName) {

@ -4,6 +4,7 @@
<meta content="text/html; charset=utf-8" http-equiv="content-type"/> <meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Cryptpad: login</title> <title>Cryptpad: login</title>
<link rel="stylesheet" href="/bower_components/components-font-awesome/css/font-awesome.min.css">
<script data-main="main" src="/bower_components/requirejs/require.js"></script> <script data-main="main" src="/bower_components/requirejs/require.js"></script>
<link rel="stylesheet" href="/customize/main.css" /> <link rel="stylesheet" href="/customize/main.css" />
<link rel="stylesheet" href="/bower_components/bootstrap/dist/css/bootstrap.min.css"> <link rel="stylesheet" href="/bower_components/bootstrap/dist/css/bootstrap.min.css">

@ -51,7 +51,7 @@ define([
} }
[ $uname, $passwd, $confirm] [ $uname, $passwd, $confirm]
.some(function ($el) { if (!$el.val()) { return ($el.focus(), true); } }); .some(function ($el) { if (!$el.val()) { $el.focus(); return true; } });
// checkboxes // checkboxes
var $checkImport = $('#import-recent'); var $checkImport = $('#import-recent');
@ -60,18 +60,6 @@ define([
var $register = $('button#register'); var $register = $('button#register');
var proxyIsSynced = function (realtime, cb) {
realtime.sync();
var interval = 300;
var check = function () {
if (realtime.getAuthDoc() !== realtime.getUserDoc()) {
return window.setTimeout(check, interval);
}
cb();
};
window.setTimeout(check, interval);
};
$register.click(function () { $register.click(function () {
var uname = $uname.val(); var uname = $uname.val();
var passwd = $passwd.val(); var passwd = $passwd.val();
@ -108,7 +96,7 @@ define([
proxy.login_name = uname; proxy.login_name = uname;
proxyIsSynced(result.realtime, function () { Cryptpad.whenRealtimeSyncs(result.realtime, function () {
document.location.href = '/drive/'; document.location.href = '/drive/';
}); });
}); });

Loading…
Cancel
Save