Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

Display name of current user on the dashboard

jonaswinkler665863e3953a
diff --git a/src-ui/src/app/components/dashboard/dashboard.component.html b/src-ui/src/app/components/dashboard/dashboard.component.html
index 627e7ff22..541255a68 100644
--- a/src-ui/src/app/components/dashboard/dashboard.component.html
+++ b/src-ui/src/app/components/dashboard/dashboard.component.html
@@ -1,4 +1,4 @@
-<app-page-header title="Dashboard" subTitle="Welcome to paperless-ng!">
+<app-page-header title="Dashboard" [subTitle]="subtitle">
<img src="assets/logo.svg" height="80" class="m-2 d-none d-md-block">
</app-page-header>
diff --git a/src-ui/src/app/components/dashboard/dashboard.component.ts b/src-ui/src/app/components/dashboard/dashboard.component.ts
index a14ec5e90..db9b5d425 100644
--- a/src-ui/src/app/components/dashboard/dashboard.component.ts
+++ b/src-ui/src/app/components/dashboard/dashboard.component.ts
@@ -1,4 +1,5 @@
import { Component, OnInit } from '@angular/core';
+import { Meta } from '@angular/platform-browser';
import { PaperlessSavedView } from 'src/app/data/paperless-saved-view';
import { SavedViewService } from 'src/app/services/rest/saved-view.service';
@@ -11,8 +12,29 @@ import { SavedViewService } from 'src/app/services/rest/saved-view.service';
export class DashboardComponent implements OnInit {
constructor(
- private savedViewService: SavedViewService) { }
+ private savedViewService: SavedViewService,
+ private meta: Meta
+ ) { }
+ get displayName() {
+ let tagFullName = this.meta.getTag('name=full_name')
+ let tagUsername = this.meta.getTag('name=username')
+ if (tagFullName && tagFullName.content) {
+ return tagFullName.content
+ } else if (tagUsername && tagUsername.content) {
+ return tagUsername.content
+ } else {
+ return null
+ }
+ }
+
+ get subtitle() {
+ if (this.displayName) {
+ return `Hello ${this.displayName}, welcome to Paperless-ng!`
+ } else {
+ return `Welcome to Paperless-ng!`
+ }
+ }
savedViews: PaperlessSavedView[] = []
diff --git a/src/documents/templates/index.html b/src/documents/templates/index.html
index d086be0fe..47a352cd5 100644
--- a/src/documents/templates/index.html
+++ b/src/documents/templates/index.html
@@ -8,6 +8,8 @@
<title>Paperless-ng</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
+ <meta name="username" content="{{username}}">
+ <meta name="full_name" content="{{full_name}}">
<meta name="cookie_prefix" content="{{cookie_prefix}}">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="stylesheet" href="{% static 'frontend/styles.css' %}"></head>
diff --git a/src/documents/views.py b/src/documents/views.py
index 54d0de3f6..43e06065f 100755
--- a/src/documents/views.py
+++ b/src/documents/views.py
@@ -57,6 +57,8 @@ class IndexView(TemplateView):
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['cookie_prefix'] = settings.COOKIE_PREFIX
+ context['username'] = self.request.user.username
+ context['full_name'] = self.request.user.get_full_name()
return context