Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/Controller/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use OCA\MyCompany\AppInfo\Application;
use OCA\Settings\Settings\Personal\PersonalInfo;
use OCA\Settings\Settings\Personal\Security\Authtokens;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
Expand All @@ -14,7 +15,8 @@
class PageController extends Controller {
public function __construct(
IRequest $request,
private PersonalInfo $personalInfo
private PersonalInfo $personalInfo,
private Authtokens $authTokens,
) {
parent::__construct(Application::APP_ID, $request);
}
Expand All @@ -25,6 +27,7 @@ public function index(string $path): TemplateResponse {
Util::addScript(Application::APP_ID, 'my_company-main');

$this->personalInfo->getForm();
$this->authTokens->getForm();

$response = new TemplateResponse(Application::APP_ID, 'main');

Expand Down
10 changes: 9 additions & 1 deletion src/components/LeftSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@
:exact="true" />
<NcAppNavigationItem :to="{name: 'profile'}"
:title="t('my_company', 'Profile')"
icon="icon-user" />
:open="false"
:allow-collapse="true"
icon="icon-user">
<template>
<NcAppNavigationItem :to="{name: 'security'}"
:title="t('my_company', 'Security')"
icon="icon-password" />
</template>
</NcAppNavigationItem>
</template>
</NcAppNavigation>
</template>
Expand Down
6 changes: 6 additions & 0 deletions src/router/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { generateUrl } from '@nextcloud/router'

import Home from '../views/Home.vue'
import Profile from '../views/Profile.vue'
import Security from '../views/Security.vue'

Vue.use(VueRouter)

Expand All @@ -24,5 +25,10 @@ export default new VueRouter({
component: Profile,
name: 'profile',
},
{
path: '/security',
component: Security,
name: 'security',
},
],
})
36 changes: 36 additions & 0 deletions src/views/Security.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<template>
<div>
<div id="personal-settings">
<h2 class="hidden-visually">
{{ t('my_company', 'Security') }}
</h2>
<PasswordSection />
<AuthTokenSection :tokens="tokens"
:can-create-token="canCreateToken" />
</div>
</div>
</template>

<script>
import { loadState } from '@nextcloud/initial-state'

// eslint-disable-next-line n/no-missing-import, import/no-unresolved
import AuthTokenSection from 'apps/settings/src/components/AuthTokenSection.vue'
// eslint-disable-next-line n/no-missing-import, import/no-unresolved
import PasswordSection from 'apps/settings/src/components/PasswordSection.vue'

export default {
name: 'Security',
components: {
PasswordSection,
AuthTokenSection,
},

data() {
return {
tokens: loadState('settings', 'app_tokens'),
canCreateToken: loadState('settings', 'can_create_app_token'),
}
},
}
</script>
2 changes: 2 additions & 0 deletions tests/psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
<files psalm-version="5.13.1@086b94371304750d1c673315321a55d15fc59015">
<file src="lib/Controller/PageController.php">
<UndefinedClass>
<code><![CDATA[$this->authTokens]]></code>
<code><![CDATA[$this->personalInfo]]></code>
<code>private</code>
<code>private</code>
</UndefinedClass>
</file>
<file src="lib/Middleware/InjectionMiddleware.php">
Expand Down