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
 | ||||
| if (config.ldap) { | ||||
|     app.post('/auth/ldap', urlencodedParser, | ||||
|         passport.authenticate('ldapauth', { successRedirect: '/' }) | ||||
|     ); | ||||
|     app.post('/auth/ldap', urlencodedParser, function (req, res, next) { | ||||
|         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
 | ||||
| if (config.email) { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user