From c3cd07ec15d45c1c0f4f75d83b76e4801849e30f Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Tue, 30 May 2017 09:54:10 +0200 Subject: [PATCH 1/3] Combine sessions and app passwords view into one single view Signed-off-by: Christoph Wurst --- settings/css/settings.css | 44 ++++++++----------------- settings/js/authtoken_view.js | 57 +++++++++++---------------------- settings/personal.php | 1 - settings/templates/personal.php | 16 --------- 4 files changed, 33 insertions(+), 85 deletions(-) diff --git a/settings/css/settings.css b/settings/css/settings.css index f2eb6282f6..4c81ac88a8 100644 --- a/settings/css/settings.css +++ b/settings/css/settings.css @@ -300,35 +300,29 @@ table.nostyle td { padding: 0.2em 0; } -#sessions table, -#apppasswords table { +#sessions table { width: 100%; min-height: 50px; padding-top: 5px; max-width: 580px; } -#sessions table th, -#apppasswords table th { +#sessions table th{ opacity: .5; } #sessions table th, -#sessions table td, -#apppasswords table th, -#apppasswords table td { +#sessions table td { padding: 10px 10px 10px 0; } -#sessions .token-list td.more, -#apppasswords .token-list td.more { +#sessions .token-list td.more { overflow: visible; position: relative; width: 16px; } -#sessions .token-list td, -#apppasswords .token-list td { +#sessions .token-list td { border-top: 1px solid #DDD; text-overflow: ellipsis; max-width: 200px; @@ -338,37 +332,30 @@ table.nostyle td { position: relative; } -#sessions tr > *:nth-child(2), -#apppasswords tr > *:nth-child(2) { +#sessions tr > *:nth-child(2) { text-align: right; } -#sessions .token-list td > a.icon, -#apppasswords .token-list td > a.icon { +#sessions .token-list td > a.icon { opacity: 0; transition: opacity 0.5s; } -#sessions .token-list a.icon, -#apppasswords .token-list a.icon { +#sessions .token-list a.icon { margin-top: 4px; display: block; } #sessions .token-list tr:hover td > a.icon, -#apppasswords .token-list tr:hover td > a.icon, -#sessions .token-list tr.active td > a.icon, -#apppasswords .token-list tr.active td > a.icon { +#sessions .token-list tr.active td > a.icon { opacity: 0.6; } -#sessions .token-list td div.configure, -#apppasswords .token-list td div.configure { +#sessions .token-list td div.configure { display: none; } -#sessions .token-list tr.active div.configure, -#apppasswords .token-list tr.active div.configure { +#sessions .token-list tr.active div.configure { display: block; position: absolute; top: 45px; @@ -376,20 +363,17 @@ table.nostyle td { padding: 10px; } -#sessions .token-list div.configure:after, -#apppasswords .token-list div.configure:after { +#sessions .token-list div.configure:after { right: 13px; } -#sessions .token-list tr.active div.configure > *, -#apppasswords .token-list tr.active div.configure > * { +#sessions .token-list tr.active div.configure > * { margin-top: 5px; margin-bottom: 5px; display: inline-block; } -#sessions .token-list tr.active a.icon-delete, -#apppasswords .token-list tr.active a.icon-delete { +#sessions .token-list tr.active a.icon-delete { background-position: left; padding-left: 20px; } diff --git a/settings/js/authtoken_view.js b/settings/js/authtoken_view.js index 9931be2ae1..fd967b7fed 100644 --- a/settings/js/authtoken_view.js +++ b/settings/js/authtoken_view.js @@ -48,15 +48,6 @@ var SubView = OC.Backbone.View.extend({ collection: null, - /** - * token type - * - 0: browser - * - 1: device - * - * @see OC\Authentication\Token\IToken - */ - type: 0, - _template: undefined, template: function (data) { @@ -68,7 +59,6 @@ }, initialize: function (options) { - this.type = options.type; this.collection = options.collection; this.on(this.collection, 'change', this.render); @@ -79,7 +69,7 @@ var list = this.$('.token-list'); var tokens = this.collection.filter(function (token) { - return token.get('type') === _this.type; + return true; }); list.html(''); @@ -183,7 +173,7 @@ var AuthTokenView = OC.Backbone.View.extend({ collection: null, - _views: [], + _view: [], _form: undefined, @@ -206,26 +196,21 @@ initialize: function (options) { this.collection = options.collection; - var tokenTypes = [0, 1]; - var _this = this; - _.each(tokenTypes, function (type) { - var el = type === 0 ? '#sessions' : '#apppasswords'; - _this._views.push(new SubView({ - el: el, - type: type, - collection: _this.collection - })); - - var $el = $(el); - $('body').on('click', _.bind(_this._hideConfigureToken, _this)); - $el.on('click', '.popovermenu', function(event) { - event.stopPropagation(); - }); - $el.on('click', 'a.icon-delete', _.bind(_this._onDeleteToken, _this)); - $el.on('click', '.icon-more', _.bind(_this._onConfigureToken, _this)); - $el.on('change', 'input.filesystem', _.bind(_this._onSetTokenScope, _this)); + var el = '#sessions'; + this._view = new SubView({ + el: el, + collection: this.collection }); + var $el = $(el); + $('body').on('click', _.bind(this._hideConfigureToken, this)); + $el.on('click', '.popovermenu', function(event) { + event.stopPropagation(); + }); + $el.on('click', 'a.icon-delete', _.bind(this._onDeleteToken, this)); + $el.on('click', '.icon-more', _.bind(this._onConfigureToken, this)); + $el.on('change', 'input.filesystem', _.bind(this._onSetTokenScope, this)); + this._form = $('#app-password-form'); this._tokenName = $('#app-password-name'); this._addAppPasswordBtn = $('#add-app-password'); @@ -233,7 +218,7 @@ this._appPasswordName = $('#app-password-name'); this._appPasswordName.on('keypress', function(event) { if (event.which === 13) { - _this._addAppPassword(); + this._addAppPassword(); } }); @@ -287,18 +272,14 @@ }, render: function () { - _.each(this._views, function (view) { - view.render(); - view.toggleLoading(false); - }); + this._view.render(); + this._view.toggleLoading(false); }, reload: function () { var _this = this; - _.each(this._views, function (view) { - view.toggleLoading(true); - }); + this._view.toggleLoading(true); var loadingTokens = this.collection.fetch(); diff --git a/settings/personal.php b/settings/personal.php index a31ad9b833..25fd460f37 100644 --- a/settings/personal.php +++ b/settings/personal.php @@ -235,7 +235,6 @@ if (\OC::$server->getAppManager()->isEnabledForUser('firstrunwizard')) { $formsAndMore[]= ['anchor' => 'clientsbox', 'section-name' => $l->t('Sync clients')]; } $formsAndMore[]= ['anchor' => 'sessions', 'section-name' => $l->t('Sessions')]; -$formsAndMore[]= ['anchor' => 'apppasswords', 'section-name' => $l->t('App passwords')]; $forms=OC_App::getForms('personal'); diff --git a/settings/templates/personal.php b/settings/templates/personal.php index 8eadfd1a22..08db5b206f 100644 --- a/settings/templates/personal.php +++ b/settings/templates/personal.php @@ -348,22 +348,6 @@ if($_['passwordChangeSupported']) { - - -
-

t('App passwords'));?>

-

t('Here you can generate individual passwords for apps so you don’t have to give out your password. You can revoke them individually too.'));?>

- - - - - - - - - - -
t('Name'));?>t('Last activity'));?>
From 91de490b9e94865e01dd5f97098def5a5449b27d Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 6 Jun 2017 13:44:37 +0200 Subject: [PATCH 2/3] Bring back the description for app passwords Signed-off-by: Joas Schilling --- settings/templates/personal.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/settings/templates/personal.php b/settings/templates/personal.php index 08db5b206f..6fba1bb30c 100644 --- a/settings/templates/personal.php +++ b/settings/templates/personal.php @@ -348,6 +348,10 @@ if($_['passwordChangeSupported']) { + +

t('App passwords'));?>

+

t('Here you can generate individual passwords for apps so you don’t have to give out your password. You can revoke them individually too.'));?>

+
From 3cae8588527d5355fb98736e73016e34fffb769b Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Tue, 6 Jun 2017 08:01:52 -0500 Subject: [PATCH 3/3] Update autoloader Signed-off-by: Morris Jobke --- lib/composer/composer/autoload_classmap.php | 2 ++ lib/composer/composer/autoload_static.php | 2 ++ 2 files changed, 4 insertions(+) diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php index 326c0856e5..02979b426b 100644 --- a/lib/composer/composer/autoload_classmap.php +++ b/lib/composer/composer/autoload_classmap.php @@ -168,6 +168,7 @@ return array( 'OCP\\Files\\Storage\\IStorage' => $baseDir . '/lib/public/Files/Storage/IStorage.php', 'OCP\\Files\\Storage\\IStorageFactory' => $baseDir . '/lib/public/Files/Storage/IStorageFactory.php', 'OCP\\Files\\UnseekableException' => $baseDir . '/lib/public/Files/UnseekableException.php', + 'OCP\\GlobalScale\\IConfig' => $baseDir . '/lib/public/GlobalScale/IConfig.php', 'OCP\\GroupInterface' => $baseDir . '/lib/public/GroupInterface.php', 'OCP\\Http\\Client\\IClient' => $baseDir . '/lib/public/Http/Client/IClient.php', 'OCP\\Http\\Client\\IClientService' => $baseDir . '/lib/public/Http/Client/IClientService.php', @@ -623,6 +624,7 @@ return array( 'OC\\Files\\Utils\\Scanner' => $baseDir . '/lib/private/Files/Utils/Scanner.php', 'OC\\Files\\View' => $baseDir . '/lib/private/Files/View.php', 'OC\\ForbiddenException' => $baseDir . '/lib/private/ForbiddenException.php', + 'OC\\GlobalScale\\Config' => $baseDir . '/lib/private/GlobalScale/Config.php', 'OC\\Group\\Backend' => $baseDir . '/lib/private/Group/Backend.php', 'OC\\Group\\Database' => $baseDir . '/lib/private/Group/Database.php', 'OC\\Group\\Group' => $baseDir . '/lib/private/Group/Group.php', diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php index c1ef42c127..5f9e571a68 100644 --- a/lib/composer/composer/autoload_static.php +++ b/lib/composer/composer/autoload_static.php @@ -198,6 +198,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c 'OCP\\Files\\Storage\\IStorage' => __DIR__ . '/../../..' . '/lib/public/Files/Storage/IStorage.php', 'OCP\\Files\\Storage\\IStorageFactory' => __DIR__ . '/../../..' . '/lib/public/Files/Storage/IStorageFactory.php', 'OCP\\Files\\UnseekableException' => __DIR__ . '/../../..' . '/lib/public/Files/UnseekableException.php', + 'OCP\\GlobalScale\\IConfig' => __DIR__ . '/../../..' . '/lib/public/GlobalScale/IConfig.php', 'OCP\\GroupInterface' => __DIR__ . '/../../..' . '/lib/public/GroupInterface.php', 'OCP\\Http\\Client\\IClient' => __DIR__ . '/../../..' . '/lib/public/Http/Client/IClient.php', 'OCP\\Http\\Client\\IClientService' => __DIR__ . '/../../..' . '/lib/public/Http/Client/IClientService.php', @@ -653,6 +654,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c 'OC\\Files\\Utils\\Scanner' => __DIR__ . '/../../..' . '/lib/private/Files/Utils/Scanner.php', 'OC\\Files\\View' => __DIR__ . '/../../..' . '/lib/private/Files/View.php', 'OC\\ForbiddenException' => __DIR__ . '/../../..' . '/lib/private/ForbiddenException.php', + 'OC\\GlobalScale\\Config' => __DIR__ . '/../../..' . '/lib/private/GlobalScale/Config.php', 'OC\\Group\\Backend' => __DIR__ . '/../../..' . '/lib/private/Group/Backend.php', 'OC\\Group\\Database' => __DIR__ . '/../../..' . '/lib/private/Group/Database.php', 'OC\\Group\\Group' => __DIR__ . '/../../..' . '/lib/private/Group/Group.php',