Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[python] masking support for numeric input #17661

Merged
merged 2 commits into from Apr 18, 2020
Merged

Conversation

ronie
Copy link
Member

@ronie ronie commented Apr 11, 2020

while the option to mask text input is available in python (ie. when entering a password), it was lacking support for numeric input.

this PR adds numeric masking support to:

  • edit controls
self.edit = xbmcgui.ControlEdit(100, 250, 125, 75, 'Password')
self.edit.setType(xbmcgui.INPUT_TYPE_PASSWORD_NUMBER_VERIFY_NEW)
  • dialog numeric
xbmcgui.Dialog().numeric(4, 'Enter password')

nummask

@MilhouseVH

@ronie ronie added Type: Feature non-breaking change which adds functionality API change: Python Component: Python v19 Matrix labels Apr 11, 2020
@ronie ronie added this to the Matrix 19.0-alpha 1 milestone Apr 11, 2020
@MilhouseVH
Copy link
Contributor

Thanks @ronie - we'll give it a test!

/// | xbmcgui.INPUT_TYPE_PASSWORD | (input is masked)
/// | xbmcgui.INPUT_TYPE_PASSWORD_MD5 | (input is masked, return md5 hash of input)
/// | xbmcgui.INPUT_TYPE_SECONDS | (format: SS or MM:SS or HH:MM:SS or MM min)
/// | xbmcgui.INPUT_TYPE_PASSWORD_NUMBER_VERIFY_NEW | (numeric input is masked)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain why the "verify new" in the constant name? Why not simply INPUT_TYPE_NUMBER_MASKED?

Copy link
Member Author

@ronie ronie Apr 12, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are 1:1 mappings to:

class CGUIEditControl : public CGUIButtonControl
{
public:
enum INPUT_TYPE {
INPUT_TYPE_READONLY = -1,
INPUT_TYPE_TEXT = 0,
INPUT_TYPE_NUMBER,
INPUT_TYPE_SECONDS,
INPUT_TYPE_TIME,
INPUT_TYPE_DATE,
INPUT_TYPE_IPADDRESS,
INPUT_TYPE_PASSWORD,
INPUT_TYPE_PASSWORD_MD5,
INPUT_TYPE_SEARCH,
INPUT_TYPE_FILTER,
INPUT_TYPE_PASSWORD_NUMBER_VERIFY_NEW
};

guess the 'verify' bit relates to the fact you need to enter a password twice when setting it, the second time is done to verify you didn't make a typo.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess what I really need, which I suspect is going to be more work, is a new INPUT_TYPE_PASSWORD_NUMBER that would accept only masked digits and that would return the entered digits. Ideally with a configurable heading. 😄

Copy link
Member

@AlwinEsch AlwinEsch Apr 12, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe remove then direct on description text the (...), think is from time where it was not included inside a table, the old:

xbmcgui.INPUT_TYPE_TEXT (standard keyboard)

@MilhouseVH
Copy link
Contributor

Many thanks for this, @ronie, however this PR isn't quite what I had in mind.

The type=4 numeric dialog is implementing the new PIN "set" logic (ie. enter a "new" password and then "verify" the same password by entering it a second time), when (as @enen92 suggests) we actually only want to mask the PIN of the user as they attempt to unlock the PIN restricted resource.

It's entirely possible type=4 as implemented by this PR would be useful in some scenario, but would it be possible to mask the single-entry numeric dialog?

Maybe a type=5 could be used to accept masked numeric input (without verify). If it can allow the heading to be configured as well that would be gravy! :)

Currently we have this dialog (unmasked):
s1

@CastagnaIT
Copy link
Collaborator

i agree with MilhouseVH,
similar case for the PIN, is in VOD addons,
you do not know the value to verify, the "verify" is demanded to VOD service server that verify the PIN entered and return if it is valid or not

so a masked numeric input (without verify) is required, would be the most useful method

@ronie
Copy link
Member Author

ronie commented Apr 13, 2020

thanx @MilhouseVH / @CastagnaIT i now get what you were looking for.

i've added another option to mask regular numeric input:
pwd = xbmcgui.Dialog().numeric(0, 'Enter PIN', bHiddenInput=True)

please test and let me know if i got it right this time ;-)

@MilhouseVH
Copy link
Contributor

Thanks @ronie - this PR is working perfectly now for my use-case!

@MilhouseVH
Copy link
Contributor

I'll include this for testing in my LibreELEC nightly builds, assuming it doesn't merge beforehand. Thanks again!

@CastagnaIT
Copy link
Collaborator

Tested is working good thanks!

@ronie
Copy link
Member Author

ronie commented Apr 18, 2020

jenkins build this please

@MilhouseVH MilhouseVH merged commit dea904b into xbmc:master Apr 18, 2020
@MilhouseVH
Copy link
Contributor

Thanks @ronie!

Maven85 pushed a commit to Maven85/kodi that referenced this pull request Apr 20, 2020
[python] masking support for numeric input
Maven85 pushed a commit to Maven85/kodi that referenced this pull request May 5, 2020
[python] masking support for numeric input
@ronie ronie deleted the numericpass branch July 29, 2020 00:09
Maven85 pushed a commit to Maven85/kodi that referenced this pull request Aug 3, 2020
[python] masking support for numeric input
Maven85 pushed a commit to Maven85/kodi that referenced this pull request Aug 4, 2020
[python] masking support for numeric input
Maven85 pushed a commit to Maven85/kodi that referenced this pull request Aug 4, 2020
[python] masking support for numeric input
Maven85 pushed a commit to Maven85/kodi that referenced this pull request Aug 5, 2020
[python] masking support for numeric input
Maven85 pushed a commit to Maven85/kodi that referenced this pull request Aug 5, 2020
[python] masking support for numeric input
Maven85 pushed a commit to Maven85/kodi that referenced this pull request Aug 6, 2020
[python] masking support for numeric input
Maven85 pushed a commit to Maven85/kodi that referenced this pull request Aug 6, 2020
[python] masking support for numeric input
Maven85 pushed a commit to Maven85/kodi that referenced this pull request Aug 6, 2020
[python] masking support for numeric input
Maven85 pushed a commit to Maven85/kodi that referenced this pull request Aug 7, 2020
[python] masking support for numeric input
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants