apla / me.apla.cordova.app-preferences

App preferences plugin for cordova
Apache License 2.0
201 stars 209 forks source link

Secure/password field #90

Open kiwinewt opened 8 years ago

kiwinewt commented 8 years ago

You currently have, in mappings.js:

// need a different handling for ios and android
// IsSecure

I have tried this, and although it is picking up the field for the preferences, it isn't picking up the password field

    password: {
        ios: "PSTextFieldSpecifier",
        android: "EditTextPreference",
        types: "string",
        required: ["key"],
        attrs: {
            keyboard: {
                android: "@android:inputType",
                ios: "KeyboardType",
                value: {
                    // Alphabet , NumbersAndPunctuation , NumberPad , URL , EmailAddress
                    // text, number, textUri, textEmailAddress
                    // ios: https://developer.apple.com/library/ios/documentation/PreferenceSettings/Conceptual/SettingsApplicationSchemaReference/Articles/PSTextFieldSpecifier.html#//apple_ref/doc/uid/TP40007011-SW1
                    // android is little weird http://developer.android.com/reference/android/widget/TextView.html#attr_android:inputType
                    number: {ios: "NumberPad", android: "number"},
                    text: {ios: "Alphabet", android: "text"},
                    uri: {ios: "URL", android: "textUri"},
                    email: {ios: "EmailAddress", android: "textEmailAddress"}
                }
            },
            password: {
                android: "@android:password",
                ios: "IsSecure",
                value: {ios: "true", android: "true"}
            },
            key:     commonMappings.key,
            title:   commonMappings.title,
            default: commonMappings.default,
        }
    },

Any ideas or external progress on this? Thanks heaps!

OliverTr54 commented 8 years ago

I do need to know about this as well - any suggestion how to solve this?

chancezeus commented 7 years ago

Fixed it like this (tested on android):

    password: {
        ios: "PSTextFieldSpecifier",
        android: "EditTextPreference",
        types: "string",
        required: ["key"],
        attrs: {
            keyboard: {
                android: "@android:inputType",
                ios: "KeyboardType",
                value: {
                    // Alphabet , NumbersAndPunctuation , NumberPad , URL , EmailAddress
                    // text, number, textUri, textEmailAddress
                    // ios: https://developer.apple.com/library/ios/documentation/PreferenceSettings/Conceptual/SettingsApplicationSchemaReference/Articles/PSTextFieldSpecifier.html#//apple_ref/doc/uid/TP40007011-SW1
                    // android is little weird http://developer.android.com/reference/android/widget/TextView.html#attr_android:inputType
                    number: {ios: "NumberPad", android: "number"},
                    text: {ios: "Alphabet", android: "text"},
                    uri: {ios: "URL", android: "textUri"},
                    email: {ios: "EmailAddress", android: "textEmailAddress"}
                }
            },
            password: {
                android: "@android:password",
                ios: "IsSecure",
                value: {
                    "true": {ios: "true", android: "true"}
                }
            },
            key:     commonMappings.key,
            title:   commonMappings.title,
            default: commonMappings.default,
        }
    },
billylo1 commented 6 years ago

thx. Tested successfully on iOS 11. Use Yes, instead of true for the IsSecure flag.

            password: {
                android: "@android:password",
                ios: "IsSecure",
                value: {
                    "true": {ios: "Yes", android: "true"}
                }
            },
rmiguez commented 6 years ago

@billylo1 Can you share the complete field definition, i'm triying last comment in IOS 11 and is not working. thanks.

billylo1 commented 6 years ago

I ended up enhancing the iOS plugin myself to support the password type.

[
  {
    "type": "group",
    "title": "Accounts",
    "items": [
      {
        "title": "User ID",
        "type": "textfield",
        "key": "userid"
      },
      {
        "title": "Password",
        "type": "textfield",
        "key": "password",
        "password": "true"
      }
    ]
  }
]
rmiguez commented 6 years ago

thanks a lot.