diff --git a/CezenLogo/Mathews.jpg b/CezenLogo/Mathews.jpg new file mode 100644 index 0000000..2cc7bb3 Binary files /dev/null and b/CezenLogo/Mathews.jpg differ diff --git a/CezenLogo/mathewes.jpg b/CezenLogo/mathewes.jpg new file mode 100644 index 0000000..a48971d Binary files /dev/null and b/CezenLogo/mathewes.jpg differ diff --git a/CezenLogo/mathews_final_db.jpg b/CezenLogo/mathews_final_db.jpg new file mode 100644 index 0000000..a48971d Binary files /dev/null and b/CezenLogo/mathews_final_db.jpg differ diff --git a/MySQL_conf_pbx/test1/mariadb_data/aria_log.00000001 b/MySQL_conf_pbx/test1/mariadb_data/aria_log.00000001 index 60adbae..74654a4 100644 Binary files a/MySQL_conf_pbx/test1/mariadb_data/aria_log.00000001 and b/MySQL_conf_pbx/test1/mariadb_data/aria_log.00000001 differ diff --git a/MySQL_conf_pbx/test1/mariadb_data/aria_log_control b/MySQL_conf_pbx/test1/mariadb_data/aria_log_control index d702b3e..ebe2d8e 100644 Binary files a/MySQL_conf_pbx/test1/mariadb_data/aria_log_control and b/MySQL_conf_pbx/test1/mariadb_data/aria_log_control differ diff --git a/MySQL_conf_pbx/test1/mariadb_data/ib_logfile0 b/MySQL_conf_pbx/test1/mariadb_data/ib_logfile0 index fc2e6b3..0a1223b 100644 Binary files a/MySQL_conf_pbx/test1/mariadb_data/ib_logfile0 and b/MySQL_conf_pbx/test1/mariadb_data/ib_logfile0 differ diff --git a/MySQL_conf_pbx/test1/reactcezenpbx/src/components/login-logout/signUp.jsx b/MySQL_conf_pbx/test1/reactcezenpbx/src/components/login-logout/signUp.jsx index 6601683..b654063 100644 --- a/MySQL_conf_pbx/test1/reactcezenpbx/src/components/login-logout/signUp.jsx +++ b/MySQL_conf_pbx/test1/reactcezenpbx/src/components/login-logout/signUp.jsx @@ -1,3 +1,5 @@ +import { createUserNewAdmin } from "../../http_routs/userHttp"; + export default function SignUp() { function onSubmitLoginForm(event) { event.preventDefault(); @@ -6,6 +8,17 @@ export default function SignUp() { const data = Object.fromEntries(formData.entries()); console.log(data); + const responseData = createUserNewAdmin(data); + + responseData.then((data) => { + console.log("Thenable"); + console.log(data); + + // if the return status is false then update the ui accordingly + if (!data?.status) { + console.log("Error"); + } + }); // event.target.reset(); } @@ -17,10 +30,10 @@ export default function SignUp() {
- +
- +
@@ -29,7 +42,7 @@ export default function SignUp() {
- +
diff --git a/MySQL_conf_pbx/test1/reactcezenpbx/src/http_routs/httpDomainName.js b/MySQL_conf_pbx/test1/reactcezenpbx/src/http_routs/httpDomainName.js new file mode 100644 index 0000000..f2e9f85 --- /dev/null +++ b/MySQL_conf_pbx/test1/reactcezenpbx/src/http_routs/httpDomainName.js @@ -0,0 +1,7 @@ +"use strict"; + +const protocol = "http"; +const domainNameOrIp = "127.0.0.1"; +const portNumber = "8081"; + +export default `${protocol}://${domainNameOrIp}:${portNumber}`; diff --git a/MySQL_conf_pbx/test1/reactcezenpbx/src/http_routs/userHttp.js b/MySQL_conf_pbx/test1/reactcezenpbx/src/http_routs/userHttp.js new file mode 100644 index 0000000..0881167 --- /dev/null +++ b/MySQL_conf_pbx/test1/reactcezenpbx/src/http_routs/userHttp.js @@ -0,0 +1,33 @@ +import socket from "./httpDomainName"; + +/** + * this is used to send the data collected from + * the signup form to the backend + * in turn it creates the user + * returns a return status with true if created + * false if there was an error if any kind + */ +export async function createUserNewAdmin(signUpObject = {}) { + // returns a promise we use await to get the response body using JSON() + const response = await fetch(`${socket}/open/signup`, { + method: "POST", + body: JSON.stringify(signUpObject), + headers: { + "content-type": "application/json", + }, + }); + + const resData = await response.json(); + + // console.log("response data"); + // console.log(resData); + + return resData; +} + +/** + * this method is used to log-in + * it uses the basic auth log-in technique + * if successful a JWT token will be returned from the backend + * use the JWT token for every subsequent request + */ diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/config/CezenLoginSecurityChain.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/config/CezenLoginSecurityChain.java index fec13ba..843e794 100644 --- a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/config/CezenLoginSecurityChain.java +++ b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/config/CezenLoginSecurityChain.java @@ -51,8 +51,8 @@ public class CezenLoginSecurityChain { public CorsConfiguration getCorsConfiguration(HttpServletRequest request) { //check CORs and CSRF in Previous commits CorsConfiguration config = new CorsConfiguration(); -// config.setAllowedOrigins(Collections.singletonList("http://localhost:4200")); - config.setAllowedOrigins(Collections.singletonList("*")); + config.setAllowedOrigins(Collections.singletonList("http://localhost:5173")); + //config.setAllowedOrigins(Collections.singletonList("*")); config.setAllowedMethods(Collections.singletonList("*")); config.setAllowCredentials(true); config.setAllowedHeaders(Collections.singletonList("*"));