Skip to content

Commit

Permalink
Merge pull request #650 from nextcloud/stable13-607-improve-password-…
Browse files Browse the repository at this point in the history
…protection-ui

[stable 13] Improve password protection UX and UI
  • Loading branch information
Ivansss authored Feb 13, 2018
2 parents 7c4d194 + 43cdb6f commit cf64d2e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 8 deletions.
6 changes: 6 additions & 0 deletions css/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,10 @@ video {
background-image: url('../img/menu-people.svg?v=1');
}

.icon-no-password {
background-image: url('../img/no-password.svg?v=1');
}

#app-sidebar .close {
position: absolute;
top: 0;
Expand Down Expand Up @@ -928,11 +932,13 @@ video {
}

.detailCallInfoContainer .clipboard-button,
.detailCallInfoContainer .password-button,
.detailCallInfoContainer .editable-text-label:hover .edit-button {
display: inline-block;
}

.detailCallInfoContainer .clipboard-button .icon,
.detailCallInfoContainer .password-button .icon,
.detailCallInfoContainer .editable-text-label .edit-button .icon {
cursor: pointer;
padding: 22px;
Expand Down
1 change: 1 addition & 0 deletions img/no-password.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 25 additions & 8 deletions js/views/callinfoview.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
' <label for="link-checkbox">' + t('spreed', 'Share link') + '</label>' +
' {{#if isPublic}}' +
' <div class="clipboard-button"><span class="icon icon-clippy"></span></div>' +
' <div class="password-button"><span class="icon {{#if hasPassword}}icon-password"{{else}}icon-no-password{{/if}}"></span></div>' +
' <div class="password-option">' +
' <input class="password-input" maxlength="200" type="password"' +
' placeholder="{{#if hasPassword}}' + t('spreed', 'Change password') + '{{else}}' + t('spreed', 'Set password') + '{{/if}}">'+
Expand Down Expand Up @@ -88,6 +89,7 @@
'joinCallButton': 'button.join-call',
'leaveCallButton': 'button.leave-call',

'passwordButton': '.password-button',
'passwordOption': '.password-option',
'passwordInput': '.password-input',
'passwordConfirm': '.password-confirm'
Expand All @@ -102,6 +104,7 @@
'change @ui.linkCheckbox': 'toggleLinkCheckbox',

'keyup @ui.passwordInput': 'keyUpPassword',
'click @ui.passwordButton': 'showPasswordInput',
'click @ui.passwordConfirm': 'confirmPassword',
'click @ui.joinCallButton': 'joinCall',
'click @ui.leaveCallButton': 'leaveCall'
Expand Down Expand Up @@ -210,6 +213,14 @@
title: t('spreed', 'Copy')
});
this.initClipboard();

this.ui.passwordOption.hide();
this.ui.passwordButton.tooltip({
placement: 'bottom',
trigger: 'hover',
title: (this.model.get('hasPassword')) ? t('spreed', 'Change password') : t('spreed', 'Set password')
});

},

_canModerate: function() {
Expand Down Expand Up @@ -265,12 +276,14 @@
/**
* Password
*/
showPasswordInput: function() {
this.ui.passwordButton.hide();
this.ui.passwordOption.show();
this.ui.passwordInput.focus();
},

confirmPassword: function() {
var newPassword = this.ui.passwordInput.val().trim();

console.log('Setting room password to "' + newPassword + '".');
console.log('Setting room password to "' + this.model.get('hasPassword') + '".');

$.ajax({
url: OC.linkToOCS('apps/spreed/api/v1/room', 2) + this.model.get('token') + '/password',
type: 'PUT',
Expand All @@ -279,12 +292,14 @@
},
success: function() {
this.ui.passwordInput.val('');

this.ui.passwordOption.hide();
this.ui.passwordButton.show();
OCA.SpreedMe.app.syncRooms();
}.bind(this)
}.bind(this),
error: function() {
OC.Notification.show(t('spreed', 'Error occurred while setting password'), {type: 'error'});
}
});

console.log('.rename-option');
},

keyUpPassword: function(e) {
Expand All @@ -294,6 +309,8 @@
} else if (e.keyCode === 27) {
// ESC
this.ui.passwordInput.val('');
this.ui.passwordOption.hide();
this.ui.passwordButton.show();
}
},

Expand Down

0 comments on commit cf64d2e

Please sign in to comment.