diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..9e4f653
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,21 @@
+image: node:latest
+
+stages:
+ - build
+ - test
+
+cache:
+ paths:
+ - node_modules/
+
+install_dependencies:
+ stage: build
+ script:
+ - npm install
+ artifacts:
+ paths:
+ - node_modules/
+
+testing_testing:
+ stage: test
+ script: npm test
\ No newline at end of file
diff --git a/smart-hut/src/App.js b/smart-hut/src/App.js
index ea84497..3c445d3 100644
--- a/smart-hut/src/App.js
+++ b/smart-hut/src/App.js
@@ -89,8 +89,8 @@ class App extends React.Component {
-
-
+
+
);
diff --git a/smart-hut/src/client_server.js b/smart-hut/src/client_server.js
index b8ed670..427d1db 100644
--- a/smart-hut/src/client_server.js
+++ b/smart-hut/src/client_server.js
@@ -8,7 +8,7 @@ export var call = {
.then(res => {
return res;
}).catch(err => {
- return err;
+ return {status : "Errore"};
});
},
register: function(data, headers) {
@@ -17,7 +17,23 @@ export var call = {
return res;
}).catch(err => {
//console.error(err);
- return err;
+ return {status : "Errore"};
});
},
+ initResetPassword: function(data, headers) {
+ return axios.post(config + 'register/init-reset-password', data)
+ .then(res => {
+ return res;
+ }).catch(err => {
+ return {status : "Errore"};
+ });
+ },
+ resetPassword: function(data, headers) {
+ return axios.put(config + 'register/reset-password', data)
+ .then(res => {
+ return res;
+ }).catch(err => {
+ return {status : "Errore"};
+ });
+ },
};
diff --git a/smart-hut/src/views/Forgot-pass-reset.js b/smart-hut/src/views/Forgot-pass-reset.js
index 39496d5..170bf1d 100644
--- a/smart-hut/src/views/Forgot-pass-reset.js
+++ b/smart-hut/src/views/Forgot-pass-reset.js
@@ -1,6 +1,6 @@
import React, {Component} from 'react';
import {Button, Form, Grid, Header, Image, Icon, Message} from 'semantic-ui-react';
-//import { call } from '../client_server';
+import { call } from '../client_server';
export default class ChangePass extends Component {
@@ -31,7 +31,20 @@ export default class ChangePass extends Component {
};
handleChangePassword = (e) => {
-
+ const params = {
+ "confirmationToken" : this.props.query.confirmationToken ,
+ "password" : this.state.password
+ }
+ call.resetPassword(params)
+ .then(res => {
+ if (res.status === "Errore") {
+ this.setState({ error: { state: true,
+ message: "Errore"}});
+ }
+ // else set a message that an email has been sent
+ }).catch(err => {
+ console.log(err);
+ });
};
render() {
diff --git a/smart-hut/src/views/Forgot-password.js b/smart-hut/src/views/Forgot-password.js
index b3f1e93..99a454d 100644
--- a/smart-hut/src/views/Forgot-password.js
+++ b/smart-hut/src/views/Forgot-password.js
@@ -1,6 +1,6 @@
import React, {Component} from 'react';
import {Button, Form, Grid, Header, Image, Icon, Message} from 'semantic-ui-react';
-//import { call } from '../client_server';
+import { call } from '../client_server';
export default class ForgotPass extends Component {
@@ -22,7 +22,21 @@ export default class ForgotPass extends Component {
};
handleSendEmail = (e) => {
+ e.preventDefault();
+ const params = {
+ "email" : this.state.user,
+ }
+ call.initResetPassword(params)
+ .then(res => {
+ if (res.status === "Errore") {
+ this.setState({ error: { state: true,
+ message: "Errore"}});
+ }
+ //set a message that an email has been sent
+ }).catch(err => {
+ console.log(err);
+ });
};
render() {