@@ -413,12 +413,33 @@ export class LoginProvider {
413413 _user . name = profile [ "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name" ] ;
414414 }
415415 _user . username = username ;
416- ( _user as any ) . mobile = profile . mobile ;
416+ if ( ! Util . IsNullEmpty ( profile [ "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/mobile" ] ) ) {
417+ ( _user as any ) . mobile = profile [ "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/mobile" ] ;
418+ }
417419 if ( Util . IsNullEmpty ( _user . name ) ) { done ( "Cannot add new user, name is empty, please add displayname to claims" , null ) ; return ; }
418420 // _user = await Config.db.InsertOne(_user, "users", 0, false, TokenUser.rootToken());
419421 var jwt : string = TokenUser . rootToken ( ) ;
420422 _user = await User . ensureUser ( jwt , _user . name , _user . username , null , null ) ;
421423 }
424+ } else {
425+ if ( ! Util . IsNullUndefinded ( _user ) ) {
426+ if ( ! Util . IsNullEmpty ( profile [ "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/mobile" ] ) ) {
427+ ( _user as any ) . mobile = profile [ "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/mobile" ] ;
428+ }
429+ await _user . Save ( jwt ) ;
430+ }
431+ }
432+
433+ if ( ! Util . IsNullUndefinded ( _user ) ) {
434+ if ( ! Util . IsNullEmpty ( profile [ "http://schemas.xmlsoap.org/claims/Group" ] ) ) {
435+ var strroles : string [ ] = profile [ "http://schemas.xmlsoap.org/claims/Group" ] ;
436+ for ( var i = 0 ; i < strroles . length ; i ++ ) {
437+ var role : Role = await Role . FindByNameOrId ( strroles [ i ] , jwt ) ;
438+ role . AddMember ( _user ) ;
439+ await role . Save ( jwt ) ;
440+ }
441+ await _user . DecorateWithRoles ( ) ;
442+ }
422443 }
423444
424445 if ( Util . IsNullUndefinded ( _user ) ) {
0 commit comments