从Titanium应用程序更新密码字段 [英] Update password field from Titanium application
问题描述
我正在使用基于Titanium的iOS应用程序。
我需要在我的应用程序中实现密码重置功能。</ p>
我发现这个 requestResetPassword
方法:
Cloud.Users .requestResetPassword({
email:'me@mycompany.com'
},function(e){
if(e.success){
alert('Success:Reset Request Sent');
} else {
alert('Error:\\\\
'+
((e.error& e.message)|| JSON.stringify e)));
}
});
从文档中,它会向用户的邮件帐户发送一个重置密码选项。但我不想要。我需要在我的应用程序中重置密码。
此外,我无法删除当前用户,并为新密码创建一个新的帐户,因为有很多为每个特定用户保存的自定义数据。所以这不是一个好的解决方案。
也找到了更新
函数,但我不知道如何使用它更新云中的密码字段,因为它不是自定义字段。
Cloud.Users.update b $ b email:'me@mycompany.com',
first_name:'m',
last_name:'e',
},function(e){
if e.success){
var user = e.users [0];
alert('Success:\\\\
'+
'id:'+ user.id +'\\ \\
'+
'first name:'+ user.first_name +'\\\\
'+
'last name:'+ user.last_name);
} else {
alert('Error:\\\\
'+
((e.error& e.message)|| JSON.stringify(e)));
}
});
有没有从我的申请做这个?如何更新我的应用程序中的用户密码字段?
推荐文档:
请帮助,提前感谢。
使用更新。像在创建调用中一样指定密码属性:
{
password:'cheese',
password_confirmation:'cheese',
email:'codfish@joe.com'
}
$ b b
http://cloud.appcelerator.com/docs/api/v1 / users / update
I'm working on a Titanium based iOS application.
In which I need to implement the password reset functionality within my app.
I found this requestResetPassword
method for doing this:
Cloud.Users.requestResetPassword({
email: 'me@mycompany.com'
}, function (e) {
if (e.success) {
alert('Success: Reset Request Sent');
} else {
alert('Error:\\n' +
((e.error && e.message) || JSON.stringify(e)));
}
});
From docs it says that, it'll send a reset password option to user's mail account. But I don't want that. I need to reset password within my application.
Also I can't remove the current user and create a new account for the same user with new password because there is a lot of custom data saved for each particular user. So that's not a good solution.
Also I found the update
function, but I don't know how to use it for updating the password field in cloud, because it is not a custom field.
Cloud.Users.update({
email: 'me@mycompany.com',
first_name: 'm',
last_name: 'e',
}, function (e) {
if (e.success) {
var user = e.users[0];
alert('Success:\\n' +
'id: ' + user.id + '\\n' +
'first name: ' + user.first_name + '\\n' +
'last name: ' + user.last_name);
} else {
alert('Error:\\n' +
((e.error && e.message) || JSON.stringify(e)));
}
});
Is there anyway to do this from my application ? How can I update user's password field within my application ?
Referred docs:
Please help, thanks in advance.
Use "update". Specify the password properties like you do in your create call:
{
password: 'cheese',
password_confirmation: 'cheese',
email: 'codfish@joe.com'
}
http://cloud.appcelerator.com/docs/api/v1/users/update
这篇关于从Titanium应用程序更新密码字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!