@ -259,7 +259,7 @@ authenticationController.login = async (req, res, next) => {
}
}
}
}
if ( isEmailLogin || isUsernameLogin ) {
if ( isEmailLogin || isUsernameLogin ) {
( res . locals . continueLogin || continueLogin ) ( strategy , req , res , next ) ;
continueLogin ( strategy , req , res , next ) ;
} else {
} else {
errorHandler ( req , res , ` [[error:wrong-login-type- ${ loginWith } ]] ` , 400 ) ;
errorHandler ( req , res , ` [[error:wrong-login-type- ${ loginWith } ]] ` , 400 ) ;
}
}
@ -303,9 +303,7 @@ function continueLogin(strategy, req, res, next) {
req . session . passwordExpired = true ;
req . session . passwordExpired = true ;
const code = await user . reset . generate ( userData . uid ) ;
const code = await user . reset . generate ( userData . uid ) ;
res . status ( 200 ) . send ( {
( res . locals . redirectAfterLogin || redirectAfterLogin ) ( req , res , ` ${ nconf . get ( 'relative_path' ) } /reset/ ${ code } ` ) ;
next : ` ${ nconf . get ( 'relative_path' ) } /reset/ ${ code } ` ,
} ) ;
} else {
} else {
delete req . query . lang ;
delete req . query . lang ;
await authenticationController . doLogin ( req , userData . uid ) ;
await authenticationController . doLogin ( req , userData . uid ) ;
@ -319,6 +317,12 @@ function continueLogin(strategy, req, res, next) {
destination = ` ${ nconf . get ( 'relative_path' ) } / ` ;
destination = ` ${ nconf . get ( 'relative_path' ) } / ` ;
}
}
( res . locals . redirectAfterLogin || redirectAfterLogin ) ( req , res , destination ) ;
}
} ) ( req , res , next ) ;
}
function redirectAfterLogin ( req , res , destination ) {
if ( req . body . noscript === 'true' ) {
if ( req . body . noscript === 'true' ) {
res . redirect ( ` ${ destination } ?loggedin ` ) ;
res . redirect ( ` ${ destination } ?loggedin ` ) ;
} else {
} else {
@ -326,8 +330,6 @@ function continueLogin(strategy, req, res, next) {
next : destination ,
next : destination ,
} ) ;
} ) ;
}
}
}
} ) ( req , res , next ) ;
}
}
authenticationController . doLogin = async function ( req , uid ) {
authenticationController . doLogin = async function ( req , uid ) {