Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var sex = (male == 1) ? 'male' : 'female';
- var data = {
- email: email.value,
- first_name: global.user_names[0],
- last_name: global.user_names[1],
- password: password.value,
- password_confirmation: password.value,
- custom_fields: '{ "dob": "'+ dob.value +'", "sex": "'+ sex +'" }' // REMOVE THIS LINE IT ALL WORKS... HAVE HAD MULTIPLE PEDRMEATATIONS, SO THIS WAY MAY NOT BE THE ONLY CAUSE OF THIS NOT WORKING, JUST THE LAST ONE I TRIED.
- };
- sdk.sendRequest('users/create.json', 'POST', data, false, callback);
- function callback(data) {
- if(data) {
- if(data.meta) {
- var meta = data.meta;
- if(meta.status == 'ok' && meta.code == 200 && meta.method_name == 'createUser') {
- var message = '';
- var user = data.response.users[0];
- Ti.API.info("User id is => " + user.id);
- var cred = [user.id, email.value];
- Ti.App.Properties.setString('credentials', cred);
- keychain.setPasswordForService(password.value, 'Heritage', email.value);
- Ti.App.fireEvent('accountLoggedIn');
- } else{
- alert(meta.status +' ' + meta.code)
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment