mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 19:15:58 +01:00 
			
		
		
		
	fix: #9032, fix login redirect for sso plugins
This commit is contained in:
		| @@ -155,16 +155,12 @@ ajaxify = window.ajaxify || {}; | |||||||
| 				app.alertError('[[global:please_log_in]]'); | 				app.alertError('[[global:please_log_in]]'); | ||||||
| 				app.previousUrl = url; | 				app.previousUrl = url; | ||||||
| 				window.location.href = config.relative_path + '/login'; | 				window.location.href = config.relative_path + '/login'; | ||||||
| 			} else if (status === 302 || status === 308) { | 			} else if ((status === 302 || status === 308) && typeof data.responseJSON === 'string') { | ||||||
| 				if (data.responseJSON && data.responseJSON.external) { | 				ajaxifyTimer = undefined; | ||||||
| 					window.location.href = data.responseJSON.external; | 				if (data.responseJSON.startsWith('http://') || data.responseJSON.startsWith('https://')) { | ||||||
| 				} else if (typeof data.responseJSON === 'string') { | 					window.location.href = data.responseJSON; | ||||||
| 					ajaxifyTimer = undefined; | 				} else { | ||||||
| 					if (data.responseJSON.startsWith('http://') || data.responseJSON.startsWith('https://')) { | 					ajaxify.go(data.responseJSON.slice(1), callback, quiet); | ||||||
| 						window.location.href = data.responseJSON; |  | ||||||
| 					} else { |  | ||||||
| 						ajaxify.go(data.responseJSON.slice(1), callback, quiet); |  | ||||||
| 					} |  | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 		} else if (textStatus !== 'abort') { | 		} else if (textStatus !== 'abort') { | ||||||
|   | |||||||
| @@ -125,12 +125,7 @@ Controllers.login = async function (req, res) { | |||||||
| 	data.allowLocalLogin = hasLoginPrivilege || parseInt(req.query.local, 10) === 1; | 	data.allowLocalLogin = hasLoginPrivilege || parseInt(req.query.local, 10) === 1; | ||||||
|  |  | ||||||
| 	if (!data.allowLocalLogin && !data.allowRegistration && data.alternate_logins && data.authentication.length === 1) { | 	if (!data.allowLocalLogin && !data.allowRegistration && data.alternate_logins && data.authentication.length === 1) { | ||||||
| 		if (res.locals.isAPI) { | 		return helpers.redirect(res, data.authentication[0].url); | ||||||
| 			return helpers.redirect(res, { |  | ||||||
| 				external: nconf.get('relative_path') + data.authentication[0].url, |  | ||||||
| 			}); |  | ||||||
| 		} |  | ||||||
| 		return res.redirect(nconf.get('relative_path') + data.authentication[0].url); |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if (req.loggedIn) { | 	if (req.loggedIn) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user