1angular.module('arPortal').factory('ProfileSvc', ['arpHttpService', 'principal', 'UserSvc', function(arpHttpService, principal, UserSvc) { 2 var ProfileSvc = {}; 3 4 ProfileSvc.updateProfile = function(user) { 5 arpHttpService.httpPut( 6 'user/profile/' + principal.identity().getId(), 7 user, 8 {caller: 'ProfileSvc.updateProfile'} 9 ); 10 return arpHttpService.deferred.promise; 11 }; 12 13 ProfileSvc.updateProfileWithResetToken = function updateProfileWithResetToken (user) { 14 arpHttpService.httpPost( 15 'user/token/' + principal.identity().getId() + '/profile', 16 user, 17 {withoutAuth: true, caller: 'ProfileSvc.updateProfileWithResetToken'} 18 ); 19 return arpHttpService.deferred.promise; 20 }; // end updateProfileWithResetToken 21 22 ProfileSvc.loadProfile = function loadProfile () { 23 // return UserSvc.loadUser(principal.identity().getId()) 24 // .then(function(user) { 25 // return getProfileDataFromUser(user); 26 // }); 27 return getProfileDataFromIdentity(); 28 }; // end loadProfile 29 30 var getProfileDataFromUser = function(user) { 31 var profile = {}; 32 profile.firstName = user.firstName; 33 profile.lastName = user.lastName; 34 profile.email = user.email; 35 profile.phone = user.phone; 36 profile.username = user.username; 37 profile.secretQuestion = user.secretQuestion; 38 profile.secretAnswer = user.secretAnswer; 39 profile.lastLogin = user.lastLogin; 40 return profile; 41 }; 42 43 function getProfileDataFromIdentity () { 44 var ident = principal.identity(); 45 // console.log('ident'); 46 // console.log(ident); 47 return { 48 firstName: ident.getFirstName(), 49 lastName: ident.getLastName(), 50 email: ident.getEmail(), 51 phone: ident.getPhone(), 52 secretQuestion: ident.getSecretQuestion(), 53 secretAnswer: null, 54 lastLogin: ident.getLastLogin(), 55 username: ident.getUsername(), 56 rsaAccount: ident.isRsaAccount() 57 }; 58 } // end getProfileDataFromIdentity 59 60 ProfileSvc.loadSecurityQuestions = function() { 61 arpHttpService.httpGet('security-questions.json?v=2', {useStaticApi: true, caller: 'ProfileSvc.loadSecurityQuestions'}); 62 return arpHttpService.deferred.promise; 63 }; 64 65 return ProfileSvc; 66}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.