Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ldap fix creation mail #71

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
[pep8]
max-line-length = 119
max-line-length = 119

[flake8]
max-line-length = 119
9 changes: 5 additions & 4 deletions teknologr/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,18 @@ def post(self, request, member_id):
with LDAPAccountManager() as lm:
try:
lm.add_account(member, username, password)
if mailToUser:
status = mailNewPassword(member, password)
if not status:
return Response("Password changed, failed to send mail", status=500)
except LDAPError as e:
return Response(str(e), status=400)

# Store account details
member.username = username
member.save()

if mailToUser:
status = mailNewPassword(member, password)
if not status:
return Response("Password created, failed to send mail", status=500)

# TODO: Send mail to user to notify about new account?

return Response(status=200)
Expand Down