File tree Expand file tree Collapse file tree 2 files changed +3
-6
lines changed Expand file tree Collapse file tree 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) {
391391
392392 user . sessionCSRF = h . getSetCookieValue ( resp , 'csrftoken' ) ;
393393 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 ) ;
396395 return cb ( null , user ) ;
397396 } ) ;
398397 } ) ;
@@ -407,7 +406,7 @@ plugin.getUser = function(user, cb) {
407406 } ) ;
408407 user . hash = favorite . id_hash ;
409408 user . name = favorites . user_name ;
410-
409+ session . saveUser ( user ) ;
411410 return cb ( null , user ) ;
412411 } ) ;
413412} ;
@@ -416,7 +415,6 @@ plugin.login = function(user, cb) {
416415 log . debug ( 'running leetcode.login' ) ;
417416 plugin . signin ( user , function ( e , user ) {
418417 if ( e ) return cb ( e ) ;
419- session . saveUser ( user ) ;
420418 plugin . getUser ( user , cb ) ;
421419 } ) ;
422420} ;
Original file line number Diff line number Diff line change @@ -53,8 +53,7 @@ describe('plugin:leetcode', function() {
5353 . reply ( 302 , '' , {
5454 'Set-Cookie' : [
5555 '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'
5857 ] } ) ;
5958
6059 nock ( 'https://leetcode.com' )
You can’t perform that action at this time.
0 commit comments