include contact nodes in profile
This commit is contained in:
		
							parent
							
								
									c152878201
								
							
						
					
					
						commit
						efae8caf3b
					
				
							
								
								
									
										13
									
								
								accounts.js
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								accounts.js
									
									
									
									
									
								
							@ -496,7 +496,7 @@ function create(deps, app) {
 | 
			
		||||
        //var contactClaimId = crypto.createHash('sha256').update(account.accountId+':'+params.username_type+':'+params.username).digest('base64');
 | 
			
		||||
        return req.Models.IssuerOauth3OrgContactNodes.get(contactClaimId).then(function (contactClaim) {
 | 
			
		||||
          var now = Date.now();
 | 
			
		||||
          if (!contactClaim) { contactClaim = { id: contactClaimId }; }
 | 
			
		||||
          if (!contactClaim) { contactClaim = { id: contactClaimId, accountId: (req.oauth3._IDX_ || req.oauth3.accountIdx) }; }
 | 
			
		||||
          if (!contactClaim.verifiedAt) { contactClaim.verifiedAt = now; }
 | 
			
		||||
          contactClaim.lastVerifiedAt = now;
 | 
			
		||||
 | 
			
		||||
@ -543,13 +543,16 @@ function create(deps, app) {
 | 
			
		||||
 | 
			
		||||
  restful.getProfile = function (req, res) {
 | 
			
		||||
    var promise = req.Models.IssuerOauth3OrgProfiles.get(req.oauth3._IDX_ || req.oauth3.accountIdx).then(function (result) {
 | 
			
		||||
      if (!result) { result = { id: undefined }; }
 | 
			
		||||
      if (!result) { return { id: undefined }; }
 | 
			
		||||
 | 
			
		||||
      result.id = undefined;
 | 
			
		||||
      //result.prv = undefined;
 | 
			
		||||
 | 
			
		||||
      return req.Models.IssuerOauth3OrgContactNodes.find({ accountId: req.oauth3.accountIdx }).then(function (nodes) {
 | 
			
		||||
        result.nodes = nodes;
 | 
			
		||||
        return result;
 | 
			
		||||
      });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    app.handlePromise(req, res, promise, '[issuer@oauth3.org] get profile');
 | 
			
		||||
  };
 | 
			
		||||
@ -599,6 +602,12 @@ function create(deps, app) {
 | 
			
		||||
    app.handlePromise(req, res, promise, '[issuer@oauth3.org] set profile');
 | 
			
		||||
  };
 | 
			
		||||
  restful.listContactNodes = function (req, res) {
 | 
			
		||||
    /*
 | 
			
		||||
    var contactClaimId = crypto.createHash('sha256').update((req.oauth3._IDX_ || req.oauth3.accountIdx)+':'+code.node.type+':'+code.node.node).digest('base64');
 | 
			
		||||
    return req.Models.IssuerOauth3OrgContactNodes.get(contactClaimId).then(function (contactClaim) {
 | 
			
		||||
      return;
 | 
			
		||||
    });
 | 
			
		||||
    */
 | 
			
		||||
  };
 | 
			
		||||
  restful.claimContact = function (req, res) {
 | 
			
		||||
    var type = req.body.type;
 | 
			
		||||
 | 
			
		||||
@ -36,7 +36,7 @@ module.exports = [
 | 
			
		||||
    tablename: apiname + '_contact_nodes',
 | 
			
		||||
    idname: 'id',
 | 
			
		||||
    // contact nodes could apply to either credential or profile?
 | 
			
		||||
    indices: baseFields.concat([ 'accountId', 'verifiedAt', 'lastVerifiedAt' ]),
 | 
			
		||||
    indices: baseFields.concat([ 'accountId', 'priority', 'verifiedAt', 'lastVerifiedAt' ]),
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    tablename: apiname + '_jwks',
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user