Sign In Register

How can we help you today?

Start a new topic
Answered

How do I validate password in RegistrationRequest?

How do I validate the password in a RegistrationRequest in Cloud Script?  I know how to get ScriptData but not request parameters.  I'll check if it's blank, and also meets certain length requirements.


(I find it odd that GameSparks doesn't throw an error if the password is blank during registration.)


Best Answer

Hi Ryan,


You can check the password by placing the following in the RegistrationRequest Cloud Code. Here i'm just checking if the password is blank, if it is an error will be thrown and the player won't be created. You can customize this to check the password for length or any other requirements you need.

   

//this gets the password data passed in via the event.
var pw = Spark.getData().password;

if(pw == ""){
    throw "Password Invalid";
}

   


Thanks,

Liam

1 Comment

Answer

Hi Ryan,


You can check the password by placing the following in the RegistrationRequest Cloud Code. Here i'm just checking if the password is blank, if it is an error will be thrown and the player won't be created. You can customize this to check the password for length or any other requirements you need.

   

//this gets the password data passed in via the event.
var pw = Spark.getData().password;

if(pw == ""){
    throw "Password Invalid";
}

   


Thanks,

Liam

Login to post a comment