Add checkbox to indicate whether this is a trusted device
This commit is contained in:
parent
d4a33656d8
commit
59535656b6
@ -13,6 +13,8 @@
|
|||||||
- MP4 and MP3 files when sent as XEP-0066 Out of Band Data, are now playable directly in chat
|
- MP4 and MP3 files when sent as XEP-0066 Out of Band Data, are now playable directly in chat
|
||||||
- Support for rendering URLs sent according to XEP-0066 Out of Band Data.
|
- Support for rendering URLs sent according to XEP-0066 Out of Band Data.
|
||||||
- Geo-URIs (e.g. from Conversations) are now replaced by links to openstreetmap (works in reverse also)
|
- Geo-URIs (e.g. from Conversations) are now replaced by links to openstreetmap (works in reverse also)
|
||||||
|
- Add a checkbox to indicate whether a trusted device is being used or not.
|
||||||
|
If the device is not trusted, then all user data is deleted from the cache upon logout.
|
||||||
|
|
||||||
### Bugfixes
|
### Bugfixes
|
||||||
|
|
||||||
|
@ -7203,7 +7203,7 @@ body.reset {
|
|||||||
#conversejs form .form-group {
|
#conversejs form .form-group {
|
||||||
margin-bottom: 2em; }
|
margin-bottom: 2em; }
|
||||||
#conversejs form .form-check-label {
|
#conversejs form .form-check-label {
|
||||||
margin-top: 0.3rem; }
|
margin-top: 0.1rem; }
|
||||||
#conversejs form .form-control::-webkit-input-placeholder {
|
#conversejs form .form-control::-webkit-input-placeholder {
|
||||||
/* Chrome/Opera/Safari */
|
/* Chrome/Opera/Safari */
|
||||||
color: #A8ABA1; }
|
color: #A8ABA1; }
|
||||||
@ -7240,7 +7240,7 @@ body.reset {
|
|||||||
margin: 1em 0; }
|
margin: 1em 0; }
|
||||||
#conversejs form.converse-form {
|
#conversejs form.converse-form {
|
||||||
background: white;
|
background: white;
|
||||||
padding: 1em; }
|
padding: 1.5em; }
|
||||||
#conversejs form.converse-form legend {
|
#conversejs form.converse-form legend {
|
||||||
color: #666;
|
color: #666;
|
||||||
font-size: 125%;
|
font-size: 125%;
|
||||||
@ -7276,6 +7276,9 @@ body.reset {
|
|||||||
#conversejs form.converse-centered-form {
|
#conversejs form.converse-centered-form {
|
||||||
text-align: center; }
|
text-align: center; }
|
||||||
|
|
||||||
|
#conversejs.fullscreen form .form-check-label {
|
||||||
|
margin-top: 0.3rem; }
|
||||||
|
|
||||||
#conversejs #user-profile-modal label {
|
#conversejs #user-profile-modal label {
|
||||||
font-weight: bold; }
|
font-weight: bold; }
|
||||||
|
|
||||||
|
@ -7245,7 +7245,7 @@ body {
|
|||||||
#conversejs form .form-group {
|
#conversejs form .form-group {
|
||||||
margin-bottom: 2em; }
|
margin-bottom: 2em; }
|
||||||
#conversejs form .form-check-label {
|
#conversejs form .form-check-label {
|
||||||
margin-top: 0.3rem; }
|
margin-top: 0.1rem; }
|
||||||
#conversejs form .form-control::-webkit-input-placeholder {
|
#conversejs form .form-control::-webkit-input-placeholder {
|
||||||
/* Chrome/Opera/Safari */
|
/* Chrome/Opera/Safari */
|
||||||
color: #A8ABA1; }
|
color: #A8ABA1; }
|
||||||
@ -7282,7 +7282,7 @@ body {
|
|||||||
margin: 1em 0; }
|
margin: 1em 0; }
|
||||||
#conversejs form.converse-form {
|
#conversejs form.converse-form {
|
||||||
background: white;
|
background: white;
|
||||||
padding: 1em; }
|
padding: 1.5em; }
|
||||||
#conversejs form.converse-form legend {
|
#conversejs form.converse-form legend {
|
||||||
color: #666;
|
color: #666;
|
||||||
font-size: 125%;
|
font-size: 125%;
|
||||||
@ -7318,6 +7318,9 @@ body {
|
|||||||
#conversejs form.converse-centered-form {
|
#conversejs form.converse-centered-form {
|
||||||
text-align: center; }
|
text-align: center; }
|
||||||
|
|
||||||
|
#conversejs.fullscreen form .form-check-label {
|
||||||
|
margin-top: 0.3rem; }
|
||||||
|
|
||||||
#conversejs #user-profile-modal label {
|
#conversejs #user-profile-modal label {
|
||||||
font-weight: bold; }
|
font-weight: bold; }
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.form-check-label {
|
.form-check-label {
|
||||||
margin-top: $form-check-input-margin-y;
|
margin-top: 0.1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-control {
|
.form-control {
|
||||||
@ -61,7 +61,7 @@
|
|||||||
|
|
||||||
&.converse-form {
|
&.converse-form {
|
||||||
background: white;
|
background: white;
|
||||||
padding: 1em;
|
padding: 1.5em;
|
||||||
legend {
|
legend {
|
||||||
color: $text-color;
|
color: $text-color;
|
||||||
font-size: 125%;
|
font-size: 125%;
|
||||||
@ -108,3 +108,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#conversejs.fullscreen {
|
||||||
|
form {
|
||||||
|
.form-check-label {
|
||||||
|
margin-top: $form-check-input-margin-y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
45
spec/login.js
Normal file
45
spec/login.js
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
(function (root, factory) {
|
||||||
|
define(["jasmine", "mock", "converse-core", "test-utils"], factory);
|
||||||
|
} (this, function (jasmine, mock, converse, test_utils) {
|
||||||
|
|
||||||
|
describe("The Login Form", function () {
|
||||||
|
|
||||||
|
it("contains a checkbox to indicate whether the computer is trusted or not",
|
||||||
|
mock.initConverseWithPromises(
|
||||||
|
null, ['connectionInitialized', 'chatBoxesInitialized'],
|
||||||
|
{ auto_login: false,
|
||||||
|
allow_registration: false },
|
||||||
|
function (done, _converse) {
|
||||||
|
|
||||||
|
test_utils.waitUntil(() => _converse.chatboxviews.get('controlbox'))
|
||||||
|
.then(function () {
|
||||||
|
var cbview = _converse.chatboxviews.get('controlbox');
|
||||||
|
test_utils.openControlBox();
|
||||||
|
const checkboxes = cbview.el.querySelectorAll('input[type="checkbox"]');
|
||||||
|
expect(checkboxes.length).toBe(1);
|
||||||
|
|
||||||
|
const checkbox = checkboxes[0];
|
||||||
|
const label = cbview.el.querySelector(`label[for="${checkbox.getAttribute('id')}"]`);
|
||||||
|
expect(label.textContent).toBe('This is a trusted device');
|
||||||
|
expect(checkbox.checked).toBe(true);
|
||||||
|
|
||||||
|
cbview.el.querySelector('input[name="jid"]').value = 'dummy@localhost';
|
||||||
|
cbview.el.querySelector('input[name="password"]').value = 'secret';
|
||||||
|
|
||||||
|
spyOn(cbview.loginpanel, 'connect');
|
||||||
|
cbview.delegateEvents();
|
||||||
|
|
||||||
|
expect(_converse.storage).toBe('session');
|
||||||
|
cbview.el.querySelector('input[type="submit"]').click();
|
||||||
|
expect(_converse.storage).toBe('local');
|
||||||
|
expect(cbview.loginpanel.connect).toHaveBeenCalled();
|
||||||
|
|
||||||
|
|
||||||
|
checkbox.click();
|
||||||
|
cbview.el.querySelector('input[type="submit"]').click();
|
||||||
|
expect(_converse.storage).toBe('session');
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
}));
|
@ -14,11 +14,8 @@
|
|||||||
allow_registration: false },
|
allow_registration: false },
|
||||||
function (done, _converse) {
|
function (done, _converse) {
|
||||||
|
|
||||||
test_utils.waitUntil(function () {
|
test_utils.waitUntil(() => _converse.chatboxviews.get('controlbox'))
|
||||||
return _converse.chatboxviews.get('controlbox');
|
|
||||||
}, 300)
|
|
||||||
.then(function () {
|
.then(function () {
|
||||||
|
|
||||||
test_utils.openControlBox();
|
test_utils.openControlBox();
|
||||||
var cbview = _converse.chatboxviews.get('controlbox');
|
var cbview = _converse.chatboxviews.get('controlbox');
|
||||||
expect($(cbview.el.querySelector('a.register-account')).length).toBe(0);
|
expect($(cbview.el.querySelector('a.register-account')).length).toBe(0);
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
define(["converse-core",
|
define(["converse-core",
|
||||||
|
"bootstrap",
|
||||||
"lodash.fp",
|
"lodash.fp",
|
||||||
"tpl!converse_brand_heading",
|
"tpl!converse_brand_heading",
|
||||||
"tpl!controlbox",
|
"tpl!controlbox",
|
||||||
@ -19,6 +20,7 @@
|
|||||||
], factory);
|
], factory);
|
||||||
}(this, function (
|
}(this, function (
|
||||||
converse,
|
converse,
|
||||||
|
bootstrap,
|
||||||
fp,
|
fp,
|
||||||
tpl_brand_heading,
|
tpl_brand_heading,
|
||||||
tpl_controlbox,
|
tpl_controlbox,
|
||||||
@ -414,6 +416,14 @@
|
|||||||
initialize (cfg) {
|
initialize (cfg) {
|
||||||
this.model.on('change', this.render, this);
|
this.model.on('change', this.render, this);
|
||||||
this.listenTo(_converse.connfeedback, 'change', this.render);
|
this.listenTo(_converse.connfeedback, 'change', this.render);
|
||||||
|
this.render();
|
||||||
|
_.forEach(this.el.querySelectorAll('[data-title]'), (el) => {
|
||||||
|
const popover = new bootstrap.Popover(el, {
|
||||||
|
'trigger': _converse.view_mode === 'mobile' && 'click' || 'hover',
|
||||||
|
'dismissible': _converse.view_mode === 'mobile' && true || false,
|
||||||
|
'container': _converse.chatboxviews.el
|
||||||
|
})
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
toHTML () {
|
toHTML () {
|
||||||
@ -465,18 +475,18 @@
|
|||||||
this.connect(_converse.jid, null);
|
this.connect(_converse.jid, null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!this.validate()) {
|
if (!this.validate()) { return; }
|
||||||
return;
|
|
||||||
}
|
const form_data = new FormData(ev.target);
|
||||||
let jid = ev.target.querySelector('input[name=jid]').value;
|
_converse.storage = form_data.get('trusted') ? 'local' : 'session';
|
||||||
|
|
||||||
|
let jid = form_data.get('jid');
|
||||||
if (_converse.locked_domain) {
|
if (_converse.locked_domain) {
|
||||||
jid = Strophe.escapeNode(jid) + '@' + _converse.locked_domain;
|
jid = Strophe.escapeNode(jid) + '@' + _converse.locked_domain;
|
||||||
} else if (_converse.default_domain && !_.includes(jid, '@')) {
|
} else if (_converse.default_domain && !_.includes(jid, '@')) {
|
||||||
jid = jid + '@' + _converse.default_domain;
|
jid = jid + '@' + _converse.default_domain;
|
||||||
}
|
}
|
||||||
this.connect(
|
this.connect(jid, form_data.get('password'));
|
||||||
jid, _.get(ev.target.querySelector('input[name=password]'), 'value')
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
connect (jid, password) {
|
connect (jid, password) {
|
||||||
|
@ -9,17 +9,25 @@
|
|||||||
{[ } else { ]}
|
{[ } else { ]}
|
||||||
{[ if (o.authentication == o.LOGIN || o.authentication == o.EXTERNAL) { ]}
|
{[ if (o.authentication == o.LOGIN || o.authentication == o.EXTERNAL) { ]}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="jid">{{{o.__("XMPP Username:")}}}</label>
|
<label for="converse-login-jid">{{{o.__("XMPP Username:")}}}</label>
|
||||||
<input class="form-control" autofocus required="required" type="text" name="jid" placeholder="{{{o.placeholder_username}}}">
|
<input id="converse-login-jid" class="form-control" autofocus required="required" type="text" name="jid" placeholder="{{{o.placeholder_username}}}">
|
||||||
</div>
|
</div>
|
||||||
{[ if (o.authentication !== o.EXTERNAL) { ]}
|
{[ if (o.authentication !== o.EXTERNAL) { ]}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="password">{{{o.__("Password:")}}}</label>
|
<label for="converse-login-password">{{{o.__("Password:")}}}</label>
|
||||||
<input class="form-control" required="required" type="password" name="password" placeholder="{{{o.__('password')}}}">
|
<input id="converse-login-password" class="form-control" required="required" type="password" name="password" placeholder="{{{o.__('password')}}}">
|
||||||
</div>
|
</div>
|
||||||
{[ } ]}
|
{[ } ]}
|
||||||
|
<div class="form-group form-check">
|
||||||
|
<input id="converse-login-trusted" type="checkbox" class="form-check-input" name="trusted" checked="checked">
|
||||||
|
<label for="converse-login-trusted" class="form-check-label">{{{o.__('This is a trusted device')}}}</label>
|
||||||
|
<i class="fa fa-info-circle" data-toggle="popover"
|
||||||
|
data-title=""
|
||||||
|
data-content="{{{o.__('To improve performance, we cache your data in this browser. Uncheck this box if you want your data to be deleted when you log out. It\'s important that you explicitly log out, otherwise not all data might be deleted.')}}}"></i>
|
||||||
|
</div>
|
||||||
|
|
||||||
<fieldset class="buttons">
|
<fieldset class="buttons">
|
||||||
<input class="btn btn-primary" type="submit" value="{{{o.__('Submit')}}}">
|
<input class="btn btn-primary" type="submit" value="{{{o.__('Log in')}}}">
|
||||||
</fieldset>
|
</fieldset>
|
||||||
{[ } ]}
|
{[ } ]}
|
||||||
{[ if (o.authentication == o.ANONYMOUS) { ]}
|
{[ if (o.authentication == o.ANONYMOUS) { ]}
|
||||||
|
@ -56,6 +56,7 @@ var specs = [
|
|||||||
"spec/chatroom",
|
"spec/chatroom",
|
||||||
"spec/minchats",
|
"spec/minchats",
|
||||||
"spec/notification",
|
"spec/notification",
|
||||||
|
"spec/login",
|
||||||
"spec/register",
|
"spec/register",
|
||||||
"spec/http-file-upload"
|
"spec/http-file-upload"
|
||||||
];
|
];
|
||||||
|
Loading…
Reference in New Issue
Block a user