From 3a04ff8823f57413f746698095854b057352abb5 Mon Sep 17 00:00:00 2001 From: Tim Zieger Date: Sun, 24 May 2020 10:46:03 +0200 Subject: [PATCH] edit user --- .../de/hft/geotime/security/WebSecurity.java | 5 +- frontend/src/App.vue | 2 +- frontend/src/router/index.js | 6 + frontend/src/views/EditUser.vue | 229 ++++++++++++++++++ frontend/src/views/Users.vue | 14 +- frontend/src/views/UsersItems.vue | 2 +- 6 files changed, 249 insertions(+), 9 deletions(-) create mode 100644 frontend/src/views/EditUser.vue diff --git a/backend/src/main/java/de/hft/geotime/security/WebSecurity.java b/backend/src/main/java/de/hft/geotime/security/WebSecurity.java index 92ab43d..8fdecfa 100644 --- a/backend/src/main/java/de/hft/geotime/security/WebSecurity.java +++ b/backend/src/main/java/de/hft/geotime/security/WebSecurity.java @@ -11,6 +11,7 @@ import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.cors.CorsConfigurationSource; import org.springframework.web.cors.UrlBasedCorsConfigurationSource; +import java.util.Arrays; import static de.hft.geotime.security.SecurityConstants.SIGN_UP_URL; @@ -43,8 +44,10 @@ public class WebSecurity extends WebSecurityConfigurerAdapter { @Bean CorsConfigurationSource corsConfigurationSource() { + final CorsConfiguration configuration = new CorsConfiguration().applyPermitDefaultValues(); + configuration.addAllowedMethod("*"); final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); - source.registerCorsConfiguration("/**", new CorsConfiguration().applyPermitDefaultValues()); + source.registerCorsConfiguration("/**", configuration); return source; } } \ No newline at end of file diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 5fcf8ad..fa428ca 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -173,7 +173,7 @@ export default { sessionStorage.setItem("loggedin", true); } else if (this.status != 200 && this.status != 0) { - console.log(this.loggedIn); + document.getElementById("loginError").innerHTML = "Login not successfull"; } diff --git a/frontend/src/router/index.js b/frontend/src/router/index.js index 67e01f4..ea94f3d 100644 --- a/frontend/src/router/index.js +++ b/frontend/src/router/index.js @@ -10,6 +10,7 @@ import Login from "../views/Login.vue"; import Register from "../views/Register.vue"; import StatisticOverview from "../views/StatisticOverview.vue"; import Users from "../views/Users.vue"; +import EditUser from "../views/EditUser.vue"; Vue.use(VueRouter); @@ -66,6 +67,11 @@ const routes = [ name: "Users", component: Users }, + { + path: "/edituser", + name: "EditUser", + component: EditUser + }, { path: '*', component: missing diff --git a/frontend/src/views/EditUser.vue b/frontend/src/views/EditUser.vue new file mode 100644 index 0000000..e412f23 --- /dev/null +++ b/frontend/src/views/EditUser.vue @@ -0,0 +1,229 @@ + + \ No newline at end of file diff --git a/frontend/src/views/Users.vue b/frontend/src/views/Users.vue index 1639f6d..5367dda 100644 --- a/frontend/src/views/Users.vue +++ b/frontend/src/views/Users.vue @@ -14,20 +14,22 @@ export default { UsersItems }, data: () => ({ - users: JSON.parse(sessionStorage.getItem("users")) + users: JSON.parse(sessionStorage.getItem("users")), + dialog: false }), methods: { - edituser(username) { - alert("Not Implemented. TimeRecordId: " + username); + edituser(userlink) { + + sessionStorage.setItem("edituser", userlink); + + window.location.href = "http://localhost:8080/edituser"; } }, created() { var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { - var usersInformation = JSON.parse(xhttp.responseText); - console.log(usersInformation); - console.log(usersInformation._embedded.users); + var usersInformation = JSON.parse(xhttp.responseText); sessionStorage.setItem( "users", JSON.stringify(usersInformation._embedded.users) diff --git a/frontend/src/views/UsersItems.vue b/frontend/src/views/UsersItems.vue index 34a7c4c..aad436c 100644 --- a/frontend/src/views/UsersItems.vue +++ b/frontend/src/views/UsersItems.vue @@ -36,7 +36,7 @@ mdi-pencil - + mdi-file-document-edit