diff --git a/backend/controller/users.js b/backend/controller/users.js
index d903489..3614c65 100644
--- a/backend/controller/users.js
+++ b/backend/controller/users.js
@@ -71,6 +71,32 @@ export const signUp = async (req, res, next) => {
}
};
+// Update user password to Database
+export const updatePasswordById = async (req, res, next) => {
+ try {
+ const id = req.body.id;
+ let sql = `UPDATE users SET password = ? WHERE id = ?`;
+ bcrypt.hash(req.body.password, 10, async (err, hash) => {
+ if (err) {
+ throw err;
+ return res.status(500).send({
+ message: err,
+ });
+ } else {
+ const results = await ownConn.query(sql, [hash, id]);
+ return res.status(200).send({
+ message: 'Password changed!',
+ });
+ }
+ });
+ }
+ catch (err) {
+ // Manage Errors
+ console.log("SQL error : ", err);
+ result(err, null);
+ }
+};
+
export const login = async (req, res, next) => {
try {
let sql = `SELECT * FROM users WHERE username = ?`;
diff --git a/backend/middleware/users.js b/backend/middleware/users.js
index 608006c..fe128c6 100644
--- a/backend/middleware/users.js
+++ b/backend/middleware/users.js
@@ -38,10 +38,7 @@ export const validateRegister = (req, res, next) => {
});
}
// password (repeat) must match
- if (
- !req.body.password_repeat ||
- req.body.password != req.body.password_repeat
- ) {
+ if (req.body.password != req.body.password_repeat) {
return res.status(400).send({
message: 'Both passwords must match',
});
diff --git a/backend/models/usersModel.js b/backend/models/usersModel.js
index 03f8bf5..41fd66b 100644
--- a/backend/models/usersModel.js
+++ b/backend/models/usersModel.js
@@ -46,8 +46,9 @@ export const getSelectedUsersByUser = async (selected, result) => {
export const updateUserById = async (data, result) => {
try {
const id = data.id;
- let sql = `UPDATE users SET username = ?, password = ?, fullName = ?, email = ?, phonenumber = ?, address = ?, city = ?, postcode = ?, adminBool = ?, technicianBool = ?, readerBool = ? WHERE id = ?`;
- const results = await ownConn.query(sql, [data.username, data.password, data.fullName, data.email, data.phonenumber, data.address, data.city, data.postcode, data.adminBool, data.technicianBool,, data.readerBool, id]);
+ let sql = `UPDATE users SET username = ?, fullName = ?, email = ?, phonenumber = ?, address = ?, city = ?, postcode = ?, adminBool = ?, technicianBool = ?, readerBool = ? WHERE id = ?`;
+ const results = await ownConn.query(sql, [data.username, data.fullName, data.email, data.phonenumber, data.address, data.city, data.postcode, data.adminBool, data.technicianBool, data.readerBool, id]);
+ results.insertId = results.insertId.toString();
result(null, results);
}
catch (err) {
@@ -57,12 +58,12 @@ export const updateUserById = async (data, result) => {
}
};
-
// Delete user to Database
export const deleteUserById = async (id, result) => {
try {
let sql = `DELETE FROM users WHERE id = ?`;
const results = await ownConn.query(sql, [id])
+ results.insertId = results.insertId.toString();
result(null, results);
}
catch (err) {
diff --git a/backend/routes/routes.js b/backend/routes/routes.js
index 390f470..05fbf96 100644
--- a/backend/routes/routes.js
+++ b/backend/routes/routes.js
@@ -108,6 +108,7 @@ import {
import {
signUp,
+ updatePasswordById,
login,
showUsers,
showUserById,
@@ -603,6 +604,9 @@ router.delete("/issueVariantsByIssueSlipId/:id", deleteIssueVariantByIssueSlipId
// sign-up process
router.post('/signUp', userMiddleware.validateRegister, signUp);
+// update password process
+router.put('/updatePassword', updatePasswordById);
+
// login process
router.post('/login', login);
diff --git a/components/LoginForm.vue b/components/LoginForm.vue
index a3c7fe2..f54858e 100644
--- a/components/LoginForm.vue
+++ b/components/LoginForm.vue
@@ -26,8 +26,11 @@
Password:
-
-
+
+
+
@@ -37,24 +40,42 @@
-
-
+
+
-
+
+
\ No newline at end of file
diff --git a/components/server/Employee.vue b/components/server/Employee.vue
new file mode 100644
index 0000000..7b38a4a
--- /dev/null
+++ b/components/server/Employee.vue
@@ -0,0 +1,476 @@
+
+
+ {{
+ employee.fullName }}
+
+
+
+
+
Username:
+
{{ employee.username }}
+
+
+
Registered:
+
{{ employee.registered }}
+
+
+
Last login:
+
{{ employee.lastLogin }}
+
+
+
+
+
+
City:
+
{{ employee.city }}
+
+
+
+
Phonenumber:
+
{{ employee.phonenumber }}
+
+
+
+
+
+
Postcode:
+
{{ employee.postcode }}
+
+
+
+
Email:
+
{{ employee.email }}
+
+
+
+
+
+
Address:
+
{{ employee.address }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/server/EmployeeGroups.vue b/components/server/EmployeeGroups.vue
new file mode 100644
index 0000000..6e59e50
--- /dev/null
+++ b/components/server/EmployeeGroups.vue
@@ -0,0 +1,485 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/server/EmployeeTable.vue b/components/server/EmployeeTable.vue
index dc96de2..16f5ce3 100644
--- a/components/server/EmployeeTable.vue
+++ b/components/server/EmployeeTable.vue
@@ -15,17 +15,17 @@
:class="['table-row', darkMode ? 'tr-darkmode' : 'tr-lightmode']">
-
+ @click="goToChosenEmployee(u.id)">
{{ u.fullName }}
|
-
+ @click="goToChosenEmployee(u.id)">
{{ u.username }}
|
@@ -45,7 +45,7 @@ import { computed } from 'vue';
// get accesss to the store
const store = useStore()
-const goToChosenAsset = (id) => {
+const goToChosenEmployee = (id) => {
store.commit('setChosenEmployee', id);
store.commit('changeToEmployee');
};
diff --git a/components/server/TemplateChecklistMVT.vue b/components/server/TemplateChecklistMVT.vue
index 69b2b33..51cce4b 100644
--- a/components/server/TemplateChecklistMVT.vue
+++ b/components/server/TemplateChecklistMVT.vue
@@ -45,7 +45,7 @@
{{ todo.commets
}} |
@@ -149,6 +149,8 @@ import Axios from '../axios.config.js';
import clientsideConfig from '../../clientsideConfig.js';
import { useStore } from 'vuex';
import { computed } from 'vue';
+// import VueInputAutowidth from 'vue-input-autowidth';
+// Vue.use(VueInputAutowidth);
const store = useStore();
const addBool = computed(() => store.state.new);
diff --git a/components/server/UserAccount.vue b/components/server/UserAccount.vue
index 05a4caf..37d1888 100644
--- a/components/server/UserAccount.vue
+++ b/components/server/UserAccount.vue
@@ -2,32 +2,243 @@
Account:
-
- E-Mail:
- ...
+
+
+ Username:
+ {{ loggedInUserUsername }}
+
+
+
+ Email:
+ {{ loggedInUserEmail }}
+
+
+
-
-
-
+
+
-
+
-
-
+
+
+
\ No newline at end of file
diff --git a/components/server/UserProfile.vue b/components/server/UserProfile.vue
index 00a031a..4ac9d6a 100644
--- a/components/server/UserProfile.vue
+++ b/components/server/UserProfile.vue
@@ -5,28 +5,221 @@
-
- Username:
- ...
+
+
+ Full name:
+ {{ loggedInUserFullName }}
+
+
+
+ Registered:
+ {{ loggedInUserRegistered }}
+
+
+ Last login:
+ {{ loggedInUserLastLogin }}
+
+
+
+
+
+ City:
+ {{ loggedInUserCity }}
+
+
+
+ Phonenumber:
+ {{ loggedInUserPhonenumber }}
+
+
+
+
+
+ Postcode:
+ {{ loggedInUserPostcode }}
+
+
+
+ Address:
+ {{ loggedInUserAddress }}
+
+
+
-
-
+
+
-
+
-
-
+
+
+
\ No newline at end of file
+ -->
\ No newline at end of file
diff --git a/documentation/.$Datenbankmodell.drawio.dtmp b/documentation/.$Datenbankmodell.drawio.dtmp
deleted file mode 100644
index 78d9294..0000000
--- a/documentation/.$Datenbankmodell.drawio.dtmp
+++ /dev/null
@@ -1,995 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
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-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/documentation/Datenbankmodell.drawio b/documentation/Datenbankmodell.drawio
index f60d6d9..4ecfed3 100644
--- a/documentation/Datenbankmodell.drawio
+++ b/documentation/Datenbankmodell.drawio
@@ -1,4 +1,4 @@
-
+
diff --git a/layouts/Actionbar.vue b/layouts/Actionbar.vue
index 9258f6d..a6bb37c 100644
--- a/layouts/Actionbar.vue
+++ b/layouts/Actionbar.vue
@@ -91,9 +91,9 @@
Instance
-
- |