Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ewieberappc/fe9c9c53351f34cd231abf216de83a17 to your computer and use it in GitHub Desktop.
Save ewieberappc/fe9c9c53351f34cd231abf216de83a17 to your computer and use it in GitHub Desktop.
Example code to use iOS 12 Credential Autofill, Password Suggestion, and One Time Code features.
var win1 = Ti.UI.createWindow({
backgroundColor: '#ddd'
});
var win2 = Ti.UI.createWindow({
backgroundColor: '#ddd'
});
var win3 = Ti.UI.createWindow({
backgroundColor: '#ddd'
});
var label1 = Ti.UI.createLabel({
top: 50,
text: "Autofill credentials"
});
var user = Ti.UI.createTextField({
autofillType: Ti.UI.AUTOFILL_TYPE_USERNAME,
width: 300,
height: 40,
top: 100,
backgroundColor: '#fff'
});
var pass = Ti.UI.createTextField({
autofillType: Ti.UI.AUTOFILL_TYPE_PASSWORD,
passwordMask: false,
width: 300,
height: 40,
top: 150,
backgroundColor: '#fff'
});
win1.add(label1);
win1.add(user);
win1.add(pass);
var label2 = Ti.UI.createLabel({
top: 50,
text: "Password suggestion"
});
var newUser = Ti.UI.createTextField({
autofillType: Ti.UI.AUTOFILL_TYPE_USERNAME,
width: 300,
height: 40,
top: 100,
backgroundColor: '#fff'
});
var newPass = Ti.UI.createTextField({
autofillType: Ti.UI.AUTOFILL_TYPE_NEW_PASSWORD,
passwordRules: 'required: upper; required: lower; required: digit; max-consecutive: 2; minlength: 8;',
passwordMask: true,
width: 300,
height: 40,
top: 150,
backgroundColor: '#fff'
});
win2.add(label2);
win2.add(newUser);
win2.add(newPass);
var label3 = Ti.UI.createLabel({
top: 50,
text: "One time code"
});
var code = Ti.UI.createTextField({
autofillType: Ti.UI.AUTOFILL_TYPE_ONE_TIME_CODE,
width: 300,
height: 40,
top: 100,
backgroundColor: '#fff'
});
win3.add(label3);
win3.add(code);
var tab1 = Ti.UI.createTab({
window: win1,
title: "Autofill credentials"
});
var tab2 = Ti.UI.createTab({
window: win2,
title: "Password suggestion"
});
var tab3 = Ti.UI.createTab({
window: win3,
title: "One time code"
});
var tabGroup = Ti.UI.createTabGroup({
tabs:[tab1,tab2,tab3]
});
tabGroup.open();
{
"webcredentials": {
"apps": [ "WY35J6ST1337.com.appc.autofill" ]
}
}
Example code to use iOS 12 Credential Autofill, Password Suggestion, and One Time Code features.
1. The app ID used in your provisioning profile has to have associated domains enabled.
2. Make sure you configure your tiapp.xml.
3. Your website that you are logging into through the app must have an apple-app-site-association file in the root or in its .well-known directory.
4. On your device, you can have some saved credentials in Settings -> Passwords & Accounts -> Website & App Passwords.
<ios>
<entitlements>
<dict>
<key>com.apple.developer.associated-domains</key>
<array>
<string>webcredentials:autofill.000webhostapp.com</string>
</array>
</dict>
</entitlements>
</ios>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment