Merge branch 'staging' of github.com:xwiki-labs/cryptpad into staging
commit
b1b294aade
|
@ -44,6 +44,18 @@ define([
|
|||
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 () {
|
||||
if (!Config.websocketPath) { return Config.websocketURL; }
|
||||
var path = Config.websocketPath;
|
||||
|
|
|
@ -70,6 +70,9 @@ define([
|
|||
Exports.loginOrRegister = function (uname, passwd, isRegister, cb) {
|
||||
if (typeof(cb) !== 'function') { return; }
|
||||
|
||||
// Usernames are all lowercase. No going back on this one
|
||||
uname = uname.toLowerCase();
|
||||
|
||||
// validate inputs
|
||||
if (!Cred.isValidUsername(uname)) { return void cb('INVAL_USER'); }
|
||||
if (!Cred.isValidPassword(passwd)) { return void cb('INVAL_PASS'); }
|
||||
|
|
|
@ -465,10 +465,10 @@ define([
|
|||
window.location.href = '/';
|
||||
});
|
||||
$userAdmin.find('a.login').click(function (e) {
|
||||
window.open('/user');
|
||||
window.location.href = '/login/';
|
||||
});
|
||||
$userAdmin.find('a.register').click(function (e) {
|
||||
window.open('/register/');
|
||||
window.location.href = '/register/';
|
||||
});
|
||||
|
||||
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 name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
<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>
|
||||
<link rel="stylesheet" href="/customize/main.css" />
|
||||
<link rel="stylesheet" href="/bower_components/bootstrap/dist/css/bootstrap.min.css">
|
||||
|
|
|
@ -51,7 +51,7 @@ define([
|
|||
}
|
||||
|
||||
[ $uname, $passwd, $confirm]
|
||||
.some(function ($el) { if (!$el.val()) { return ($el.focus(), true); } });
|
||||
.some(function ($el) { if (!$el.val()) { $el.focus(); return true; } });
|
||||
|
||||
// checkboxes
|
||||
var $checkImport = $('#import-recent');
|
||||
|
@ -60,18 +60,6 @@ define([
|
|||
|
||||
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 () {
|
||||
var uname = $uname.val();
|
||||
var passwd = $passwd.val();
|
||||
|
@ -108,7 +96,7 @@ define([
|
|||
|
||||
proxy.login_name = uname;
|
||||
|
||||
proxyIsSynced(result.realtime, function () {
|
||||
Cryptpad.whenRealtimeSyncs(result.realtime, function () {
|
||||
document.location.href = '/drive/';
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue