diff --git a/.eslintcache b/.eslintcache index 64a462ec..f2fe2213 100644 --- a/.eslintcache +++ b/.eslintcache @@ -1 +1 @@ -[{"/Users/pveiga/repos/wisemapping-react/src/Footer.js":"1","/Users/pveiga/repos/wisemapping-react/src/Header.js":"2","/Users/pveiga/repos/wisemapping-react/src/index.js":"3","/Users/pveiga/repos/wisemapping-react/src/RegistrationApp.js":"4","/Users/pveiga/repos/wisemapping-react/src/LoginApp.js":"5"},{"size":1609,"mtime":1607011308675,"results":"6","hashOfConfig":"7"},{"size":1924,"mtime":1607015196109,"results":"8","hashOfConfig":"7"},{"size":1883,"mtime":1606789677736,"results":"9","hashOfConfig":"7"},{"size":3903,"mtime":1607041654675,"results":"10","hashOfConfig":"7"},{"size":3515,"mtime":1607011370081,"results":"11","hashOfConfig":"7"},{"filePath":"12","messages":"13","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1xegajf",{"filePath":"14","messages":"15","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"16","messages":"17","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"18","messages":"19","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"20","messages":"21","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/Users/pveiga/repos/wisemapping-react/src/Footer.js",[],"/Users/pveiga/repos/wisemapping-react/src/Header.js",[],"/Users/pveiga/repos/wisemapping-react/src/index.js",[],"/Users/pveiga/repos/wisemapping-react/src/RegistrationApp.js",[],"/Users/pveiga/repos/wisemapping-react/src/LoginApp.js",[]] \ No newline at end of file +[{"/Users/pveiga/repos/wisemapping-react/src/Footer.js":"1","/Users/pveiga/repos/wisemapping-react/src/Header.js":"2","/Users/pveiga/repos/wisemapping-react/src/index.js":"3","/Users/pveiga/repos/wisemapping-react/src/RegistrationApp.js":"4","/Users/pveiga/repos/wisemapping-react/src/LoginApp.js":"5"},{"size":1609,"mtime":1607011308675,"results":"6","hashOfConfig":"7"},{"size":1924,"mtime":1607015196109,"results":"8","hashOfConfig":"7"},{"size":1883,"mtime":1607118506285,"results":"9","hashOfConfig":"7"},{"size":4123,"mtime":1607126426627,"results":"10","hashOfConfig":"7"},{"size":3519,"mtime":1607114188755,"results":"11","hashOfConfig":"7"},{"filePath":"12","messages":"13","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1xegajf",{"filePath":"14","messages":"15","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"16","messages":"17","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"18","messages":"19","errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"20","messages":"21","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/Users/pveiga/repos/wisemapping-react/src/Footer.js",[],"/Users/pveiga/repos/wisemapping-react/src/Header.js",[],"/Users/pveiga/repos/wisemapping-react/src/index.js",[],"/Users/pveiga/repos/wisemapping-react/src/RegistrationApp.js",["22"],"/Users/pveiga/repos/wisemapping-react/src/LoginApp.js",[],{"ruleId":"23","severity":1,"message":"24","line":59,"column":13,"nodeType":"25","messageId":"26","endLine":59,"endColumn":19},"no-unused-vars","'status' is assigned a value but never used.","Identifier","unusedVar"] \ No newline at end of file diff --git a/lang/en.json b/lang/en.json index f4c5fe51..ce471db5 100644 --- a/lang/en.json +++ b/lang/en.json @@ -1,60 +1,87 @@ { - "footer.aboutus": { - "defaultMessage": "About Us" - }, - "footer.contactus": { - "defaultMessage": "Contact Us" - }, - "footer.donations": { - "defaultMessage": "Donations" - }, - "header.donthaveaccount": { - "defaultMessage": "Don't have an account ?" - }, - "login.email": { - "defaultMessage": "Email" - }, - "footer.faq": { - "defaultMessage": "F.A.Q." - }, - "footer.feedback": { - "defaultMessage": "Feedback" - }, - "login.forgotpwd": { - "defaultMessage": "Forgot Password ?" - }, - "login.error": { - "defaultMessage": "The email address or password you entered is not valid." - }, - "login.loginto": { - "defaultMessage": "Log Into Your Account" - }, - "login.hsqldbcofig": { - "defaultMessage": "Warning: Although HSQLDB is bundled with WiseMapping by default during the installation, we do not recommend this database for production use. Please consider using MySQL 5.7 instead. You can find more information how to configure MySQL", - "description": "Missing production database configured" - }, - "footer.opensource": { - "defaultMessage": "Open Source" - }, - "login.password": { - "defaultMessage": "Password" - }, - "login.remberme": { - "defaultMessage": "Remember me" - }, - "login.signin": { - "defaultMessage": "Sign In" - }, - "login.signup": { - "defaultMessage": "Sign Up" - }, - "footer.termsandconditions": { - "defaultMessage": "Term And Conditions" - }, - "login.userinactive": { - "defaultMessage": "Sorry, your account has not been activated yet. You'll receive a notification email when it becomes active. Stay tuned!." - }, - "login.welcome": { - "defaultMessage": "Welcome" - } + "footer.aboutus": { + "defaultMessage": "About Us" + }, + "footer.contactus": { + "defaultMessage": "Contact Us" + }, + "footer.donations": { + "defaultMessage": "PayPal Donations" + }, + "footer.faq": { + "defaultMessage": "F.A.Q." + }, + "footer.feedback": { + "defaultMessage": "Feedback" + }, + "footer.opensource": { + "defaultMessage": "Open Source" + }, + "footer.termsandconditions": { + "defaultMessage": "Term And Conditions" + }, + "header.donthaveaccount": { + "defaultMessage": "Don't have an account ?" + }, + "header.haveaccount": { + "defaultMessage": "Already have an account?" + }, + "login.email": { + "defaultMessage": "Email" + }, + "login.error": { + "defaultMessage": "The login.email address or login.password you entered is not valid." + }, + "login.forgotpwd": { + "defaultMessage": "Forgot Password ?" + }, + "login.hsqldbcofig": { + "defaultMessage": "Although HSQLDB is bundled with WiseMapping by default during the installation, we do not recommend this database for production use. Please consider using MySQL 5.7 instead. You can find more information how to configure MySQL", + "description": "Missing production database configured" + }, + "login.loginto": { + "defaultMessage": "Log Into Your Account" + }, + "login.password": { + "defaultMessage": "Password" + }, + "login.remberme": { + "defaultMessage": "Remember me" + }, + "login.signin": { + "defaultMessage": "Sign In" + }, + "login.signup": { + "defaultMessage": "Sign Up" + }, + "login.userinactive": { + "defaultMessage": "Sorry, your account has not been activated yet. You'll receive a notification login.email when it becomes active. Stay tuned!." + }, + "login.welcome": { + "defaultMessage": "Welcome" + }, + "registration.become": { + "defaultMessage": "Become a member of our comunity" + }, + "registration.email": { + "defaultMessage": "Email" + }, + "registration.firstname": { + "defaultMessage": "First Name" + }, + "registration.lastname": { + "defaultMessage": "Last Name" + }, + "registration.password": { + "defaultMessage": "Password" + }, + "registration.register": { + "defaultMessage": "Register" + }, + "registration.signup": { + "defaultMessage": "Signing up is free and just take a moment" + }, + "registration.termandconditions": { + "defaultMessage": "Terms of Service: Please check the WiseMapping Account information you've entered above, and review the Terms of Service here. By clicking on 'Register' below you are agreeing to the Terms of Service above and the Privacy Policy" + } } \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index b2724e5c..784fa974 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,16 +1,18 @@ { "name": "wisemapping-react", - "version": "0.1.3", + "version": "0.1.4", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "0.1.3", + "version": "0.1.4", "license": "https://wisemapping.atlassian.net/wiki/spaces/WS/pages/524357/WiseMapping+Public+License+Version+1.0+WPL", "dependencies": { "@testing-library/jest-dom": "^5.11.6", "@testing-library/react": "^11.2.2", "@testing-library/user-event": "^12.2.2", + "axios": "^0.21.0", + "cors": "^2.8.5", "react": "^17.0.1", "react-dom": "^17.0.1", "react-google-recaptcha": "^2.1.0", @@ -4231,6 +4233,14 @@ "node": ">=4" } }, + "node_modules/axios": { + "version": "0.21.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.0.tgz", + "integrity": "sha512-fmkJBknJKoZwem3/IKSSLpkdNXZeBu5Q7GA/aRsr2btgrptmSCxi2oFjZHqGdK9DoTil9PIHlPIZw2EcRJXRvw==", + "dependencies": { + "follow-redirects": "^1.10.0" + } + }, "node_modules/axobject-query": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-2.2.0.tgz", @@ -5865,6 +5875,18 @@ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, + "node_modules/cors": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", + "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", + "dependencies": { + "object-assign": "^4", + "vary": "^1" + }, + "engines": { + "node": ">= 0.10" + } + }, "node_modules/cosmiconfig": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.0.0.tgz", @@ -24980,6 +25002,14 @@ "resolved": "https://registry.npmjs.org/axe-core/-/axe-core-4.1.1.tgz", "integrity": "sha512-5Kgy8Cz6LPC9DJcNb3yjAXTu3XihQgEdnIg50c//zOC/MyLP0Clg+Y8Sh9ZjjnvBrDZU4DgXS9C3T9r4/scGZQ==" }, + "axios": { + "version": "0.21.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.0.tgz", + "integrity": "sha512-fmkJBknJKoZwem3/IKSSLpkdNXZeBu5Q7GA/aRsr2btgrptmSCxi2oFjZHqGdK9DoTil9PIHlPIZw2EcRJXRvw==", + "requires": { + "follow-redirects": "^1.10.0" + } + }, "axobject-query": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-2.2.0.tgz", @@ -26316,6 +26346,15 @@ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, + "cors": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", + "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", + "requires": { + "object-assign": "^4", + "vary": "^1" + } + }, "cosmiconfig": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.0.0.tgz", diff --git a/package.json b/package.json index 456be9fc..139818ec 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,8 @@ "@testing-library/jest-dom": "^5.11.6", "@testing-library/react": "^11.2.2", "@testing-library/user-event": "^12.2.2", + "axios": "^0.21.0", + "cors": "^2.8.5", "react": "^17.0.1", "react-dom": "^17.0.1", "react-google-recaptcha": "^2.1.0", diff --git a/src/LoginApp.js b/src/LoginApp.js index 0deb2f26..e38b5d21 100644 --- a/src/LoginApp.js +++ b/src/LoginApp.js @@ -58,12 +58,12 @@ class LoginForm extends React.Component {
- - + +
- +
diff --git a/src/RegistrationApp.js b/src/RegistrationApp.js index c21b93ed..bb664244 100644 --- a/src/RegistrationApp.js +++ b/src/RegistrationApp.js @@ -1,18 +1,19 @@ import './css/registration.css'; import React from 'react'; +import axios from 'axios'; import { FormattedMessage, IntlProvider, injectIntl } from 'react-intl' import ReCAPTCHA from "react-google-recaptcha"; import Header from './Header.js'; import Footer from './Footer.js'; + const ErrorMessageDialog = (props) => { let result; const message = props.message; if (message) { - const message = "here is a messar ofr error eerera rser wer" result =

{message}

} else { result = @@ -34,16 +35,32 @@ class RegistrationForm extends React.Component { } handleChange(event) { - this.setState({ value: event.target.value }); + this.setState({ [event.target.name]: event.target.value }); } handleRecaptchaChange(value) { this.setState({ "recaptcha": value }); } - handleSubmit(event) { - this.setState({ errorMsg: "Error Message" }); + async handleSubmit(event) { event.preventDefault(); + + const { errorMsg, ...rest } = this.state; + + await axios.post("http://localhost:8080/service/user", + rest, + { headers: { 'Content-Type': 'application/json' } } + ).then(response => { + alert(response.data); + this.setState({ errorMsg: "Error Message" }); + }).catch(error => { + // Handle error ... + const data = error.response.data; + const status = error.response.status; + + const errorMsg = Object.values(data.fieldErrors)[0]; + this.setState({ "errorMsg": errorMsg}); + }); } render() { @@ -59,11 +76,10 @@ class RegistrationForm extends React.Component {
- - - - - + + + +