LDAP login improvements
- return bad request if no username or password given - return to referer url on auth success - flash error message on auth failure
This commit is contained in:
		
							parent
							
								
									3007163799
								
							
						
					
					
						commit
						fc8d709afb
					
				
							
								
								
									
										12
									
								
								app.js
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								app.js
									
									
									
									
									
								
							| @ -382,9 +382,15 @@ if (config.google) { | |||||||
| } | } | ||||||
| // ldap auth
 | // ldap auth
 | ||||||
| if (config.ldap) { | if (config.ldap) { | ||||||
|     app.post('/auth/ldap', urlencodedParser, |     app.post('/auth/ldap', urlencodedParser, function (req, res, next) { | ||||||
|         passport.authenticate('ldapauth', { successRedirect: '/' }) |         if (!req.body.username || !req.body.password) return response.errorBadRequest(res); | ||||||
|     ); |         setReturnToFromReferer(req); | ||||||
|  |         passport.authenticate('ldapauth', { | ||||||
|  |             successReturnToOrRedirect: config.serverurl + '/', | ||||||
|  |             failureRedirect: config.serverurl + '/', | ||||||
|  |             failureFlash: true | ||||||
|  |         })(req, res, next); | ||||||
|  |     }); | ||||||
| } | } | ||||||
| // email auth
 | // email auth
 | ||||||
| if (config.email) { | if (config.email) { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user