Skip to content

Commit

Permalink
Remove try-except block that does nothing
Browse files Browse the repository at this point in the history
nothing in there can ever raise a ldap.Error. my guess this is
copy pasted from a bit further up in the same function
  • Loading branch information
stveit committed Feb 28, 2024
1 parent d96a876 commit 751b534
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions python/nav/web/webfront/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,17 +230,12 @@ def do_login(request):
LogEntry.add_log_entry(
account, 'log-in', '{actor} logged in', before=account
)

try:
request.session[ACCOUNT_ID_VAR] = account.id
request.account = account
except ldap.Error as error:
errors.append('Error while talking to LDAP:\n%s' % error)
else:
_logger.info("%s successfully logged in", account.login)
if not origin:
origin = reverse('webfront-index')
return HttpResponseRedirect(origin)
request.session[ACCOUNT_ID_VAR] = account.id
request.account = account
_logger.info("%s successfully logged in", account.login)
if not origin:
origin = reverse('webfront-index')
return HttpResponseRedirect(origin)
else:
_logger.info("failed login: %r", username)
errors.append(
Expand Down

0 comments on commit 751b534

Please sign in to comment.