Recover Password option in Susi Chromebot
Chromebot is the chrome extension made for SUSI.AI which is a open source project by FOSSASIA.
This time I added the option of recover password to the chromebot.
In Susi Accounts Server there is a endpoint present for recovering forgotten password -
api.susi.ai/aaa/recoverpassword.json?forgotemail=EMAIL
So using it I added the recover password option to it
The task was divided into two parts -
- UI design - For Front end design I had just gone with the Susi themed colour
blue
Screenshot of UI
This is a simple UI design which was made by using bootstrap.
- Working behind the UI
I had to access the API endpoint with AJAX and make the request for recover password the JS code for it is attached below -
var resetPasswordEndPoint = BASE_URL+"/aaa/recoverpassword.json?forgotemail="+ encodeURIComponent(email);
$.ajax({
url: resetPasswordEndPoint,
dataType: "jsonp",
jsonpCallback: "p",
jsonp: "callback",
crossDomain: true,
success: function (response) {
if(response.accepted){
alert(response.message);
showResetBlock(false);
}
},
error: function (jqXHR) {
var msg = "";
console.log(jqXHR);
var jsonValue = jqXHR.status;
if (jsonValue === 404) {
msg = "Reset Password Failed. Try Again";
}
alert(msg);
}
});
Now after clicking on the reset password button the screen changes to
And when I check my email viola there you have it the reset link.
Just as a proof of work -
Link to commit
My merged PR link is attached to the post.
Thanks! For reading
Posted on Utopian.io - Rewarding Open Source Contributors