I use a custom virtual keyboard in my game because I want that the player can only use specific characters for his password. I always check the players password in cloud script when a player adds his username, password and email with AddUsernamePassword API. Now, I want to create password recovery for the two different cases:
1) Player wants to change his password in my game when he is logged in and he/she has forgotten his password.
2) Player wants to change his password when he is not logged in and he/she has forgotten his password.
I don't want to use a custom server. I want to use Azure Functions so that the player can enter a new password in my game and after that I want to check if he/she only uses my supported characters in the new desired password. In addition, I check the minimum and maximum length of the desired password. If everything is fine with the new password, then change the password in the players account.
How can I create password recovery for those two different cases?
It's very important that the player only uses the specific characters to create his/her password, because my custom virtual keyboard only supports those specific characters. There are no buttons for other characters on the virtual keyboard.
Supported characters(my cloud script code):
function VerifyTextUnicodePassword(text) { var notSupportArray = new Array(); for (var i = text.length - 1; i >= 0; i--) { var charCode = text.charCodeAt(i); if ((charCode == 33) || (charCode == 35) || (charCode == 38) || (charCode >= 40 && charCode <= 42) || (charCode == 46) || (charCode >= 48 && charCode <= 57) || (charCode >= 65 && charCode <= 91) || (charCode == 93) || (charCode == 95) || (charCode >= 97 && charCode <= 123) || (charCode == 125)) { } else { notSupportArray.push(charCode); } } if (notSupportArray.length == 0) { return true; } else { return false; } }