0
下面是我用于我的云用户登录代码...轻微的问题是;每当我登录和注销时,插入到文本字段中的数据都不会消失......我不希望它们被保存,我希望用户在注销后再次插入文本字段。钛登录/注册
//create textfields for sign_in page/interface
var userNameField = Titanium.UI.createTextField({
color: 'black',
hintText: 'username',
height: 35,
top: 120,
left: 10,
width: 250,
borderStyle: Titanium.UI.INPUT_BORDERSTYLE_ROUNDED
});
win.add(userNameField);
var passwordField = Titanium.UI.createTextField({
color: 'black',
hintText: 'password',
height: 35,
top: 160,
left: 10,
width: 250,
passwordMask: true,
borderStyle: Titanium.UI.INPUT_BORDERSTYLE_ROUNDED
});
win.add(passwordField);
var button = Titanium.UI.createButton({
title: 'log in',
top: 190,
left: 10,
width: 100,
height:50,
Color:'#336699'
});
win.add(button);
//then create event listener and login user to ACS cloud server
button.addEventListener('click', function(){
Cloud.Users.login({
login: userNameField.value,
password: passwordField.value,
}, function (e) {
if (e.success) {
var user = e.users[0];
alert('success');
} else {
alert('Unable to log you in:' + e.message);
}
});
});
由于阿南德。像魔术一样,它工作。 –
对不起Anand,一个简单的问题,如果用户希望他/她的登录数据被应用程序记住(如记住我),那该怎么办。 –
@MarvelGerrard:请参阅http://stackoverflow.com/questions/14331696/update-password-field-from-titanium-application和http://stackoverflow.com/questions/6395814/how-to-store-userid-用户名in-titanium – Anand