@@ -62,7 +62,7 @@ PasswordGrantType.prototype.handle = function(request, client) {
6262
6363 return Promise . bind ( this )
6464 . then ( function ( ) {
65- return this . getUser ( request ) ;
65+ return this . getUser ( request , client . id ) ;
6666 } )
6767 . then ( function ( user ) {
6868 return this . saveToken ( user , client , scope ) ;
@@ -73,7 +73,7 @@ PasswordGrantType.prototype.handle = function(request, client) {
7373 * Get user using a username/password combination.
7474 */
7575
76- PasswordGrantType . prototype . getUser = function ( request ) {
76+ PasswordGrantType . prototype . getUser = function ( request , oauth_client_id ) {
7777 debug ( "======PasswordGrantType: getUser======" )
7878 if ( ! request . body . username ) {
7979 throw new InvalidRequestError ( 'Missing parameter: `username`' ) ;
@@ -90,12 +90,8 @@ PasswordGrantType.prototype.getUser = function(request) {
9090 if ( ! is . uchar ( request . body . password ) ) {
9191 throw new InvalidRequestError ( 'Invalid parameter: `password`' ) ;
9292 }
93- /*var model = this.model.getUser;
94- if (request.body.username.includes('iot_sensor_')) {
95- model = this.model.getIotSensor;
96- }*/
9793
98- return promisify ( this . model . getIdentity , 2 ) . call ( this . model , request . body . username , request . body . password )
94+ return promisify ( this . model . getIdentity , 3 ) . call ( this . model , request . body . username , request . body . password , oauth_client_id )
9995 . then ( function ( user ) {
10096 if ( ! user ) {
10197 throw new InvalidGrantError ( 'Invalid grant: user credentials are invalid' ) ;
0 commit comments