diff --git a/lib/private/Settings/Manager.php b/lib/private/Settings/Manager.php index 41db5be974..10f7224b9a 100644 --- a/lib/private/Settings/Manager.php +++ b/lib/private/Settings/Manager.php @@ -371,6 +371,11 @@ class Manager implements IManager { $form = new Personal\PersonalInfo($this->config, $this->userManager, $this->groupManager, $this->accountManager, $this->l10nFactory, $this->defaults, $this->l); $forms[$form->getPriority()] = [$form]; } + if($section === 'sessions') { + /** @var ISettings $form */ + $form = new Personal\Sessions(); + $forms[$form->getPriority()] = [$form]; + } } catch (QueryException $e) { // skip } @@ -405,6 +410,8 @@ class Manager implements IManager { public function getPersonalSections() { $sections = [ 0 => [new Section('personal-info', $this->l->t('Personal info'), 0, $this->url->imagePath('core', 'actions/info.svg'))], + 1 => [new Section('sessions', $this->l->t('Sessions'), 0, $this->url->imagePath('settings', 'admin.svg'))], + ]; return $sections; } diff --git a/lib/private/Settings/Personal/Sessions.php b/lib/private/Settings/Personal/Sessions.php new file mode 100644 index 0000000000..22f8a44b17 --- /dev/null +++ b/lib/private/Settings/Personal/Sessions.php @@ -0,0 +1,59 @@ + + * + * @author Arthur Schiwon + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +namespace OC\Settings\Personal; + + +use OCP\AppFramework\Http\TemplateResponse; +use OCP\Settings\ISettings; + +class Sessions implements ISettings { + + /** + * @return TemplateResponse returns the instance with all parameters set, ready to be rendered + * @since 9.1 + */ + public function getForm() { + return new TemplateResponse('settings', 'settings/personal/sessions'); + } + + /** + * @return string the section ID, e.g. 'sharing' + * @since 9.1 + */ + public function getSection() { + return 'sessions'; + } + + /** + * @return int whether the form should be rather on the top or bottom of + * the admin section. The forms are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. + * + * E.g.: 70 + * @since 9.1 + */ + public function getPriority() { + return 10; + } +} diff --git a/settings/js/settings/sessions.js b/settings/js/settings/sessions.js new file mode 100644 index 0000000000..953727e39d --- /dev/null +++ b/settings/js/settings/sessions.js @@ -0,0 +1,7 @@ +$(document).ready(function () { + var collection = new OC.Settings.AuthTokenCollection(); + var view = new OC.Settings.AuthTokenView({ + collection: collection + }); + view.reload(); +}); diff --git a/settings/templates/settings/personal/sessions.php b/settings/templates/settings/personal/sessions.php new file mode 100644 index 0000000000..81613f0f27 --- /dev/null +++ b/settings/templates/settings/personal/sessions.php @@ -0,0 +1,48 @@ + + * + * @author Arthur Schiwon + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +script('settings', [ + 'authtoken', + 'authtoken_collection', + 'authtoken_view', + 'settings/sessions' +]); + +?> + + +
+

t('Sessions'));?>

+

t('Web, desktop and mobile clients currently logged in to your account.'));?>

+ + + + + + + + + + +
t('Device'));?>t('Last activity'));?>
+