Complete registration

This commit is contained in:
Paulo Gustavo Veiga 2020-12-04 16:03:13 -08:00
parent 19aaebd366
commit 0d3414dcb5
7 changed files with 325 additions and 149 deletions

View File

@ -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",[]] [{"/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"]

View File

@ -6,13 +6,7 @@
"defaultMessage": "Contact Us" "defaultMessage": "Contact Us"
}, },
"footer.donations": { "footer.donations": {
"defaultMessage": "Donations" "defaultMessage": "PayPal Donations"
},
"header.donthaveaccount": {
"defaultMessage": "Don't have an account ?"
},
"login.email": {
"defaultMessage": "Email"
}, },
"footer.faq": { "footer.faq": {
"defaultMessage": "F.A.Q." "defaultMessage": "F.A.Q."
@ -20,22 +14,34 @@
"footer.feedback": { "footer.feedback": {
"defaultMessage": "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": { "login.forgotpwd": {
"defaultMessage": "Forgot Password ?" "defaultMessage": "Forgot Password ?"
}, },
"login.error": { "login.hsqldbcofig": {
"defaultMessage": "The email address or password you entered is not valid." "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": { "login.loginto": {
"defaultMessage": "Log Into Your Account" "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": { "login.password": {
"defaultMessage": "Password" "defaultMessage": "Password"
}, },
@ -48,13 +54,34 @@
"login.signup": { "login.signup": {
"defaultMessage": "Sign Up" "defaultMessage": "Sign Up"
}, },
"footer.termsandconditions": {
"defaultMessage": "Term And Conditions"
},
"login.userinactive": { "login.userinactive": {
"defaultMessage": "Sorry, your account has not been activated yet. You'll receive a notification email when it becomes active. Stay tuned!." "defaultMessage": "Sorry, your account has not been activated yet. You'll receive a notification login.email when it becomes active. Stay tuned!."
}, },
"login.welcome": { "login.welcome": {
"defaultMessage": "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"
} }
} }

43
package-lock.json generated
View File

@ -1,16 +1,18 @@
{ {
"name": "wisemapping-react", "name": "wisemapping-react",
"version": "0.1.3", "version": "0.1.4",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "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", "license": "https://wisemapping.atlassian.net/wiki/spaces/WS/pages/524357/WiseMapping+Public+License+Version+1.0+WPL",
"dependencies": { "dependencies": {
"@testing-library/jest-dom": "^5.11.6", "@testing-library/jest-dom": "^5.11.6",
"@testing-library/react": "^11.2.2", "@testing-library/react": "^11.2.2",
"@testing-library/user-event": "^12.2.2", "@testing-library/user-event": "^12.2.2",
"axios": "^0.21.0",
"cors": "^2.8.5",
"react": "^17.0.1", "react": "^17.0.1",
"react-dom": "^17.0.1", "react-dom": "^17.0.1",
"react-google-recaptcha": "^2.1.0", "react-google-recaptcha": "^2.1.0",
@ -4231,6 +4233,14 @@
"node": ">=4" "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": { "node_modules/axobject-query": {
"version": "2.2.0", "version": "2.2.0",
"resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-2.2.0.tgz", "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", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" "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": { "node_modules/cosmiconfig": {
"version": "7.0.0", "version": "7.0.0",
"resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.0.0.tgz", "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", "resolved": "https://registry.npmjs.org/axe-core/-/axe-core-4.1.1.tgz",
"integrity": "sha512-5Kgy8Cz6LPC9DJcNb3yjAXTu3XihQgEdnIg50c//zOC/MyLP0Clg+Y8Sh9ZjjnvBrDZU4DgXS9C3T9r4/scGZQ==" "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": { "axobject-query": {
"version": "2.2.0", "version": "2.2.0",
"resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-2.2.0.tgz", "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", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" "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": { "cosmiconfig": {
"version": "7.0.0", "version": "7.0.0",
"resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.0.0.tgz", "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.0.0.tgz",

View File

@ -5,6 +5,8 @@
"@testing-library/jest-dom": "^5.11.6", "@testing-library/jest-dom": "^5.11.6",
"@testing-library/react": "^11.2.2", "@testing-library/react": "^11.2.2",
"@testing-library/user-event": "^12.2.2", "@testing-library/user-event": "^12.2.2",
"axios": "^0.21.0",
"cors": "^2.8.5",
"react": "^17.0.1", "react": "^17.0.1",
"react-dom": "^17.0.1", "react-dom": "^17.0.1",
"react-google-recaptcha": "^2.1.0", "react-google-recaptcha": "^2.1.0",

View File

@ -58,12 +58,12 @@ class LoginForm extends React.Component {
<LoginError /> <LoginError />
<form action="/c/perform-login" method="POST"> <form action="/c/perform-login" method="POST">
<input type="email" name="username" placeholder={intl.formatMessage({ id: "login.email", defaultMessage: "Email" })} required="true" autocomplete="email" /> <input type="email" name="username" placeholder={intl.formatMessage({ id: "login.email", defaultMessage: "Email" })} required={true} autoComplete="email" />
<input type="password" name="password" placeholder={intl.formatMessage({ id: "login.password", defaultMessage: "Password" })} required="true" autocomplete="current-password" /> <input type="password" name="password" placeholder={intl.formatMessage({ id: "login.password", defaultMessage: "Password" })} required={true} autoComplete="current-password" />
<div> <div>
<input name="_spring_security_login.remberme" id="staySignIn" type="checkbox" /> <input name="_spring_security_login.remberme" id="staySignIn" type="checkbox" />
<label for="staySignIn"><FormattedMessage id="login.remberme" defaultMessage="Remember me" /></label> <label htmlFor="staySignIn"><FormattedMessage id="login.remberme" defaultMessage="Remember me" /></label>
</div> </div>
<input type="submit" value={intl.formatMessage({ id: "login.signin", defaultMessage: "Sign In" })} /> <input type="submit" value={intl.formatMessage({ id: "login.signin", defaultMessage: "Sign In" })} />
</form> </form>

View File

@ -1,18 +1,19 @@
import './css/registration.css'; import './css/registration.css';
import React from 'react'; import React from 'react';
import axios from 'axios';
import { FormattedMessage, IntlProvider, injectIntl } from 'react-intl' import { FormattedMessage, IntlProvider, injectIntl } from 'react-intl'
import ReCAPTCHA from "react-google-recaptcha"; import ReCAPTCHA from "react-google-recaptcha";
import Header from './Header.js'; import Header from './Header.js';
import Footer from './Footer.js'; import Footer from './Footer.js';
const ErrorMessageDialog = (props) => { const ErrorMessageDialog = (props) => {
let result; let result;
const message = props.message; const message = props.message;
if (message) { if (message) {
const message = "here is a messar ofr error eerera rser wer"
result = <p className='form-error-dialog'>{message}</p> result = <p className='form-error-dialog'>{message}</p>
} else { } else {
result = <span></span> result = <span></span>
@ -34,16 +35,32 @@ class RegistrationForm extends React.Component {
} }
handleChange(event) { handleChange(event) {
this.setState({ value: event.target.value }); this.setState({ [event.target.name]: event.target.value });
} }
handleRecaptchaChange(value) { handleRecaptchaChange(value) {
this.setState({ "recaptcha": value }); this.setState({ "recaptcha": value });
} }
handleSubmit(event) { async handleSubmit(event) {
this.setState({ errorMsg: "Error Message" });
event.preventDefault(); 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() { render() {
@ -59,11 +76,10 @@ class RegistrationForm extends React.Component {
<ErrorMessageDialog message={errrMsg} /> <ErrorMessageDialog message={errrMsg} />
<form action="/" method="POST" onSubmit={this.handleSubmit}> <form action="/" method="POST" onSubmit={this.handleSubmit}>
<input type="email" name="username" onChange={this.handleChange} placeholder={intl.formatMessage({ id: "registration.email", defaultMessage: "Email" })} required="true" autoComplete="email" /> <input type="email" name="email" onChange={this.handleChange} placeholder={intl.formatMessage({ id: "registration.email", defaultMessage: "Email" })} required={true} autoComplete="email" />
<input type="text" name="firstname" onChange={this.handleChange} placeholder={intl.formatMessage({ id: "registration.firstname", defaultMessage: "First Name" })} required="true" autoComplete="given-name" /> <input type="text" name="firstname" onChange={this.handleChange} placeholder={intl.formatMessage({ id: "registration.firstname", defaultMessage: "First Name" })} required={true} autoComplete="given-name" />
<input type="text" name="lastname" onChange={this.handleChange} placeholder={intl.formatMessage({ id: "registration.lastname", defaultMessage: "Last Name" })} required="true" autoComplete="family-name" /> <input type="text" name="lastname" onChange={this.handleChange} placeholder={intl.formatMessage({ id: "registration.lastname", defaultMessage: "Last Name" })} required={true} autoComplete="family-name" />
<input type="password" name="password" onChange={this.handleChange} placeholder={intl.formatMessage({ id: "registration.password", defaultMessage: "Password" })} required="true" autoComplete="new-password" /> <input type="password" name="password" onChange={this.handleChange} placeholder={intl.formatMessage({ id: "registration.password", defaultMessage: "Password" })} required={true} autoComplete="new-password" />
<input type="password" name="retypePassword" onChange={this.handleChange} placeholder={intl.formatMessage({ id: "registration.retypepassword", defaultMessage: "Retype Password" })} required="true" autoComplete="new-password" />
<div> <div>
<ReCAPTCHA <ReCAPTCHA

View File

@ -1,78 +1,170 @@
{ {
"footer.aboutus": [{ "footer.aboutus": [
{
"type": 0, "type": 0,
"value": "About Us" "value": "About Us"
}], }
"footer.contactus": [{ ],
"footer.contactus": [
{
"type": 0, "type": 0,
"value": "Contact Us" "value": "Contact Us"
}], }
"footer.donations": [{ ],
"footer.donations": [
{
"type": 0, "type": 0,
"value": "Donations" "value": "PayPal Donations"
}], }
"footer.faq": [{ ],
"footer.faq": [
{
"type": 0, "type": 0,
"value": "F.A.Q." "value": "F.A.Q."
}], }
"footer.feedback": [{ ],
"footer.feedback": [
{
"type": 0, "type": 0,
"value": "Feedback" "value": "Feedback"
}], }
"footer.opensource": [{ ],
"footer.opensource": [
{
"type": 0, "type": 0,
"value": "Open Source" "value": "Open Source"
}], }
"footer.termsandconditions": [{ ],
"footer.termsandconditions": [
{
"type": 0, "type": 0,
"value": "Term And Conditions" "value": "Term And Conditions"
}], }
"header.donthaveaccount": [{ ],
"header.donthaveaccount": [
{
"type": 0, "type": 0,
"value": "Don't have an account ?" "value": "Don't have an account ?"
}], }
"login.email": [{ ],
"header.haveaccount": [
{
"type": 0,
"value": "Already have an account?"
}
],
"login.email": [
{
"type": 0, "type": 0,
"value": "Email" "value": "Email"
}], }
"login.error": [{ ],
"login.error": [
{
"type": 0, "type": 0,
"value": "The email address or password you entered is not valid." "value": "The login.email address or login.password you entered is not valid."
}], }
"login.forgotpwd": [{ ],
"login.forgotpwd": [
{
"type": 0, "type": 0,
"value": "Forgot Password ?" "value": "Forgot Password ?"
}], }
"login.hsqldbcofig": [{ ],
"login.hsqldbcofig": [
{
"type": 0, "type": 0,
"value": "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" "value": "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"
}], }
"login.loginto": [{ ],
"login.loginto": [
{
"type": 0, "type": 0,
"value": "Log Into Your Account" "value": "Log Into Your Account"
}], }
"login.password": [{ ],
"login.password": [
{
"type": 0, "type": 0,
"value": "Password" "value": "Password"
}], }
"login.remberme": [{ ],
"login.remberme": [
{
"type": 0, "type": 0,
"value": "Remember me" "value": "Remember me"
}], }
"login.signin": [{ ],
"login.signin": [
{
"type": 0, "type": 0,
"value": "Sign In" "value": "Sign In"
}], }
"login.signup": [{ ],
"login.signup": [
{
"type": 0, "type": 0,
"value": "Sign Up" "value": "Sign Up"
}], }
"login.userinactive": [{ ],
"login.userinactive": [
{
"type": 0, "type": 0,
"value": "Sorry, your account has not been activated yet. You'll receive a notification email when it becomes active. Stay tuned!." "value": "Sorry, your account has not been activated yet. You'll receive a notification login.email when it becomes active. Stay tuned!."
}], }
"login.welcome": [{ ],
"login.welcome": [
{
"type": 0, "type": 0,
"value": "Welcome" "value": "Welcome"
}] }
],
"registration.become": [
{
"type": 0,
"value": "Become a member of our comunity"
}
],
"registration.email": [
{
"type": 0,
"value": "Email"
}
],
"registration.firstname": [
{
"type": 0,
"value": "First Name"
}
],
"registration.lastname": [
{
"type": 0,
"value": "Last Name"
}
],
"registration.password": [
{
"type": 0,
"value": "Password"
}
],
"registration.register": [
{
"type": 0,
"value": "Register"
}
],
"registration.signup": [
{
"type": 0,
"value": "Signing up is free and just take a moment"
}
],
"registration.termandconditions": [
{
"type": 0,
"value": "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"
}
]
} }