diff --git a/src/components/worbli-signin.js b/src/components/worbli-signin.js
index 16465b8..10c71e4 100644
--- a/src/components/worbli-signin.js
+++ b/src/components/worbli-signin.js
@@ -76,6 +76,7 @@ class WorbliSignin extends PolymerElement {
.error{
color: #E54D53;
margin-bottom:6px;
+ cursor: pointer;
}
.comment {
display: block;
@@ -90,12 +91,24 @@ class WorbliSignin extends PolymerElement {
-
Sign In
- Welcome back to WORBLI!
-
-
-
-
+
+
+
+ Sign In
+ Welcome back to WORBLI!
+
+
+
+
+
+
+ Forgot Password?
+ Enter your email address
+
+
+
+
+
New to Worbli? Join WORBLI
`;
}
@@ -114,6 +127,10 @@ class WorbliSignin extends PolymerElement {
type: Boolean,
value: false,
},
+ forgotPassword: {
+ type: Boolean,
+ value: false,
+ },
apiPath: {
type: Text,
},
@@ -124,6 +141,33 @@ _join(){
this.join = true;
}
+_toggle(){
+ this.error = "";
+ this.forgotPassword = true;
+}
+_reset(){
+ this.error = "";
+ const data = {
+ email: this.email,
+ }
+ const url = `${this.apiPath}/user/reset/`;
+ fetch(url, {
+ method: 'POST',
+ body: JSON.stringify(data),
+ headers:{'Content-Type': 'application/json'}
+ })
+ .then(response => {
+ return response.json();
+ })
+ .then(response => {
+ this.forgotPassword = false;
+ this.dispatchEvent(new CustomEvent('hideOverlay',{bubbles: true, composed: true, detail: {action: 'hide'}}));
+ })
+ .catch(error => {
+ this.error = "Please, try again";
+ });
+}
+
_login(){
this.error = "";
const data = {
@@ -144,11 +188,11 @@ _login(){
this.set('route.path', `/dashboard/profile/`);
this.dispatchEvent(new CustomEvent('hideOverlay',{bubbles: true, composed: true, detail: {action: 'hide'}}));
} else {
- this.error = "Incorect email and password combination";
+ this.error = "Forgot password?, Click here to reset your password.";
}
})
.catch(error => {
- this.error = "Incorect email and password combination";
+ this.error = "Forgot password?, Click here to reset your password.";
});
}