2 var userCtx = r.userCtx;
4 // load the profile from the user doc
5 var db = $.couch.db(r.info.authentication_db);
6 var userDocId = "org.couchdb.user:"+userCtx.name;
7 db.openDoc(userDocId, {
8 success : function(userDoc) {
9 var profile = userDoc["couch.app.profile"];
11 // we copy the name to the profile so it can be used later
12 // without publishing the entire userdoc (roles, pass, etc)
13 profile.name = userDoc.name;
14 $$(widget).profile = profile;
15 widget.trigger("profileReady", [profile]);
17 widget.trigger("noProfile", [userCtx]);