- Home /
When Inputfield is set to password, php login script fails.
If the content type of an input field is set to password and that data is set to a php login script it will fail to recognize it as the correct password, even if it's typed in properly. Set the type back to text and it works just fine. Anyone know why? Thanks!
Answer by villevli · Nov 20, 2017 at 10:17 PM
Make sure you're using the InputField.text property to retrieve the value, not Text.text. Both InputField and Text have a property named text. The InputField.text will return the unmasked value and Text.text will return what is displayed.
I am. For whatever reason, when it is debuged out, it shows as all asterisks ***. That seems to be what is passed into the WWWFOR$$anonymous$$ and on to the php script. Is there a way to unmask the entered field data before it gets encoded and sent?
That's not possible. $$anonymous$$ake sure you read this answer carefully. You should not read Text.text
but InputField.text You most likely are reading the text property of the text component which is used to display the *****
.
The only case where the result might be different when an onscreen touch keyboard is used. However you haven't said anything about your target platform.
Inside UpdateLabel the InputField actually reads the current "text" and if it's a password field it creates a temporary string that has the same length but only consists of "asteriskChar". This temporary string is only used to update the Text component that is displayed. However reading InputField.text does return the actual string.
Answer by Bertlapp · May 03, 2019 at 10:09 PM
As mentioned above,
A reference to an InputField is needed in script. And not an reference to a text object. It's a bit confusing.
[SerializeField]
private InputField input_Password;
Now you can pull the password data from the reference by calling
string password = input_Password.text;
Your answer
Follow this Question
Related Questions
Call single function in php from c#? 1 Answer
PHP Android WWW Unknown Error 1 Answer
Remember currently logged in player 1 Answer