Search code examples
derbyjs

How to get email of Derby-Login user


I can easily get the user id from model.get("session.userId"); I am having trouble finding out how to use this to get the user's email.


Solution

  • If you have a Users collection, you can use the userId to get the user object which would have the user's email.

    // in the controller
    var userId = model.get('session.userId');
    userEmail = model.get('users.' + userId + '.email');
    
    // in the view
    <div>#root.users[userId].email</div>
    

    Hope that is helpful :)