Userprofile

1. I have added a second call to fetch the info i need for the profile page. I am wondering if this extra info shouldn't be returned from the auth call, because this breaks the current login test.

2. This profile page only works correctly when you log in as root. otherwise, it returns authorized.

3. should there be a separate endpoint to fetch and update the profile? I am currently using /users/
The the passwordHash property of the userProfile object should be set using
the hash generated by the password, The userprofile call can only therefore
be made after the authinterceptor has that. this code is clarified in my
lastest commit


On Tue, Jul 22, 2014 at 10:07 AM, Ryan Crichton <notifications@github.com>
wrote:

> In app/scripts/services/login.js:
>
> > +            var hash = sha512.finalize();
> > +
> > +            passwordhash = hash.toString(CryptoJS.enc.
> Hex);
> > +            username = email;
> > +            // Fetch currently logged in user's profile
> > +            userProfile = Api.Users.get({ email: email }, function (userProfile) {
> > +              done(userProfile);
> > +              return  userProfile;
> > +            }, function (){
> > +              done(false);
> > +            });
> > +            //Add values to UserProfile
> > +            userProfile.passwordHash = passwordhash;
> > +            userProfile.username = email;
> > +            // notify the authInterceptor of a logged in user
> > +            Authinterceptor.setLoggedInUser(userProfile);
>
> Perhaps the above 5 lines should be in the success function of the
> Api.Users.get(...) call. Then it wait for the call to return before
> setting the userProfile on the authinterceptor.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/jembi/openhim-console/pull/40/files#r15215159>.
>



-- 
Duma Mtungwa
Software Developer
Mobile: +27 72 806 9205
-massacre-