From b17916be4b550371812d56a1d570264393b3113d Mon Sep 17 00:00:00 2001 From: Mark van Renswoude Date: Sat, 28 Apr 2018 11:34:32 +0200 Subject: [PATCH] Implemented user editing --- lib/repository/user.js | 1 + public/src/app.js | 3 + public/src/locale/en.js | 32 ++++- public/src/locale/nl.js | 6 +- public/src/route/admin/Codes.vue | 12 +- public/src/route/admin/Landing.vue | 6 + public/src/route/admin/Uploads.vue | 10 +- public/src/route/admin/UserDetail.vue | 189 ++++++++++++++++++++++++++ public/src/route/admin/Users.vue | 102 +++++++++++++- 9 files changed, 348 insertions(+), 13 deletions(-) create mode 100644 public/src/route/admin/UserDetail.vue diff --git a/lib/repository/user.js b/lib/repository/user.js index 63a4f5c..b5931b6 100644 --- a/lib/repository/user.js +++ b/lib/repository/user.js @@ -1,3 +1,4 @@ +const _ = require('lodash'); const AuthTokens = require('../authtokens'); const bcrypt = require('bcrypt'); diff --git a/public/src/app.js b/public/src/app.js index 15a7a8d..80ca524 100644 --- a/public/src/app.js +++ b/public/src/app.js @@ -83,6 +83,7 @@ Vue.filter('formatSizeSI', (value) => const Code = () => import('./route/Code.vue'); const AdminCodeDetail = () => import('./route/admin/CodeDetail.vue'); +const AdminUserDetail = () => import('./route/admin/UserDetail.vue'); const router = new VueRouter({ @@ -101,6 +102,8 @@ const router = new VueRouter({ { path: 'codes/edit/:codeParam', component: AdminCodeDetail, props: true }, { path: 'codes', component: () => import('./route/admin/Codes.vue') }, { path: 'profile', component: () => import('./route/admin/Profile.vue') }, + { path: 'users/add', component: AdminUserDetail }, + { path: 'users/edit/:idParam', component: AdminUserDetail, props: true }, { path: 'users', component: () => import('./route/admin/Users.vue') }, { path: '', name: 'adminRoot', component: () => import('./route/admin/Login.vue') } ] diff --git a/public/src/locale/en.js b/public/src/locale/en.js index 4120537..8c8aab6 100644 --- a/public/src/locale/en.js +++ b/public/src/locale/en.js @@ -51,7 +51,8 @@ export default { uploads: { created: 'Date', code: 'Code', - owner: 'Owner' + owner: 'Owner', + userDeleted: 'deleted' }, codes: { @@ -60,7 +61,8 @@ export default { list: { code: 'Code', owner: 'Owner', - actions: 'Actions' + actions: 'Actions', + userDeleted: 'deleted' }, detail: { @@ -74,6 +76,32 @@ export default { message: 'Message', messageHint: 'The message will be displayed to the user on the upload page after the code is entered. Markdown is supported.' } + }, + + users: { + add: 'Add user', + + list: { + username: 'Username / name', + inactive: '(inactive)', + email: 'Email', + actions: 'Actions' + }, + + detail: { + username: 'Username', + name: 'Name', + email: 'Email', + password: 'Password', + passwordHint: 'Enter a new password to change the password. Leave blank to keep the current password.', + auth: { + title: 'Authorization', + viewAllCodes: 'Manage codes created by other users', + viewAllUploads: 'Manage uploads created by other users', + manageUsers: 'Manage users' + }, + active: 'Active' + } } } } \ No newline at end of file diff --git a/public/src/locale/nl.js b/public/src/locale/nl.js index f164d85..7007a88 100644 --- a/public/src/locale/nl.js +++ b/public/src/locale/nl.js @@ -51,7 +51,8 @@ export default { uploads: { created: 'Datum', code: 'Code', - owner: 'Eigenaar' + owner: 'Eigenaar', + userDeleted: 'verwijderd' }, codes: { @@ -60,7 +61,8 @@ export default { list: { code: 'Code', owner: 'Eigenaar', - actions: 'Acties' + actions: 'Acties', + userDeleted: 'verwijderd' }, detail: { diff --git a/public/src/route/admin/Codes.vue b/public/src/route/admin/Codes.vue index 57430a7..bb1a1b5 100644 --- a/public/src/route/admin/Codes.vue +++ b/public/src/route/admin/Codes.vue @@ -4,18 +4,22 @@
-
{{ $t('admin.codes.list.code') }}
-
{{ $t('admin.codes.list.owner') }}
+
{{ $t('admin.codes.list.code') }}
+
{{ $t('admin.codes.list.owner') }}
{{ $t('admin.codes.list.actions') }}
-
+
{{ code.id }} {{ code.description }}
-
{{ code.username }}
+
+ + {{ code.username || $t('admin.codes.list.userDeleted') }} + +
diff --git a/public/src/route/admin/Landing.vue b/public/src/route/admin/Landing.vue index 7fb339d..5f877ad 100644 --- a/public/src/route/admin/Landing.vue +++ b/public/src/route/admin/Landing.vue @@ -192,4 +192,10 @@ $list-padding: .2rem; font-size: 75%; color: #808080; } + +.userDeleted +{ + font-style: italic; + color: #808080; +} \ No newline at end of file diff --git a/public/src/route/admin/Uploads.vue b/public/src/route/admin/Uploads.vue index 5fae7ad..15132bd 100644 --- a/public/src/route/admin/Uploads.vue +++ b/public/src/route/admin/Uploads.vue @@ -1,12 +1,16 @@