Skip to content

Commit

Permalink
fix: remove mail from username data
Browse files Browse the repository at this point in the history
  • Loading branch information
PedroHenriqueDevBR committed Jan 10, 2024
1 parent f55b024 commit ee7dd91
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ldap_password/apps/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,14 @@ def create_context(self, data: QueryDict):
context["repeate_password"] = data.get("repeate_password")
return context

def format_username(self, username):
if "@" not in username:
return username
username_splited = username.split("@")
return username_splited[0]

def change_ldap_password(self, request: HttpRequest, data: QueryDict):
username = data.get("username") or ""
username = self.format_username(data.get("username") or "")
current_password = data.get("current_password") or ""
new_password = data.get("new_password") or ""
ldap_search = SearchLDAPUser()
Expand Down

0 comments on commit ee7dd91

Please sign in to comment.