File tree 2 files changed +3
-6
lines changed
2 files changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -391,8 +391,7 @@ plugin.signin = function(user, cb) {
391
391
392
392
user . sessionCSRF = h . getSetCookieValue ( resp , 'csrftoken' ) ;
393
393
user . sessionId = h . getSetCookieValue ( resp , 'LEETCODE_SESSION' ) ;
394
- user . name = h . getSetCookieValue ( resp , 'messages' )
395
- . match ( 'Successfully signed in as ([^.]*)' ) [ 1 ] ;
394
+ session . saveUser ( user ) ;
396
395
return cb ( null , user ) ;
397
396
} ) ;
398
397
} ) ;
@@ -407,7 +406,7 @@ plugin.getUser = function(user, cb) {
407
406
} ) ;
408
407
user . hash = favorite . id_hash ;
409
408
user . name = favorites . user_name ;
410
-
409
+ session . saveUser ( user ) ;
411
410
return cb ( null , user ) ;
412
411
} ) ;
413
412
} ;
@@ -416,7 +415,6 @@ plugin.login = function(user, cb) {
416
415
log . debug ( 'running leetcode.login' ) ;
417
416
plugin . signin ( user , function ( e , user ) {
418
417
if ( e ) return cb ( e ) ;
419
- session . saveUser ( user ) ;
420
418
plugin . getUser ( user , cb ) ;
421
419
} ) ;
422
420
} ;
Original file line number Diff line number Diff line change @@ -53,8 +53,7 @@ describe('plugin:leetcode', function() {
53
53
. reply ( 302 , '' , {
54
54
'Set-Cookie' : [
55
55
'csrftoken=SESSION_CSRF_TOKEN; Max-Age=31449600; Path=/; secure' ,
56
- 'LEETCODE_SESSION=SESSION_ID; Max-Age=31449600; Path=/; secure' ,
57
- "messages='Successfully signed in as Eric.'; Max-Age=31449600; Path=/; secure"
56
+ 'LEETCODE_SESSION=SESSION_ID; Max-Age=31449600; Path=/; secure'
58
57
] } ) ;
59
58
60
59
nock ( 'https://leetcode.com' )
You can’t perform that action at this time.
0 commit comments