Skip to content

Commit

Permalink
Merge pull request #114 from iMMAP/fix/login_email_username
Browse files Browse the repository at this point in the history
login using email or username and small fixes
  • Loading branch information
shtayeb authored Dec 14, 2023
2 parents 43ae41d + ab02f5e commit 5aa820c
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 7 deletions.
1 change: 0 additions & 1 deletion scripts/data/updated_nov_2023/user.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2212,7 +2212,6 @@ _id,admin0pcode,cluster_id,createdAt,email,last_logged_in,name,organization_id,p
5c443c6ad22c4e21023c22f5,SY,cvwg,2019-01-20T09:16:26.987Z,[email protected],2019-01-20T09:16:26.992Z,Abdulrahman Sufian,5aae9fd36658c721130ff1d6,$2a$10$DGR/HeSfiGm4HPR4FPr9zOxnhBMZXaSIGS4WwvC/lWNsg2kY7xjUO,+,IMO /Training,"[""USER""]",,active,2019-01-20T09:16:26.992Z,asufian,1
5f30fda2a0364654438e62c6,SY,esnfi,2020-08-10T07:56:18.097Z,[email protected],2020-08-10T07:56:18.111Z,Mais Al Suradi,5f30fda2a0364654438e62c5,$2a$10$FB2bLd1FlqQcX7h6ON2yquINs36aPfojXapza5Ik4dsC04/dksOai,962796151828,Coordinator and Support Officer for Whole of Syria,"[""USER"",""ORG""]",,active,2020-08-10T07:56:18.111Z,alsuradi,1
62b17a507a2d47ac073d2c79,SY,wash,2022-06-21T07:59:12.566Z,[email protected],2022-06-21T07:59:12.000Z,Umar Daraz,62b17a507a2d47ac073d2c78,$2a$10$I3BXPZziGb.xAyRwNtKRp.ldc8DOblh9i1ovlTAKoga6EJcSNH/Ja,923005125922,IM Specialist,"[""USER"",""ORG""]",,active,2022-06-21T07:59:12.588Z,udaraz,1
5b9b95cfe292fb823c0fd796,UA,wash,2018-09-14T11:04:47.765Z,[email protected],2021-10-19T08:51:28.000Z,kaponda mulambia,5b9b95cfe292fb823c0fd795,$2a$10$FbnuqqR6q.dnfbojWEpxm.opxS4BJm8lkPdPN9XAXqLevaeMZ/3cy,998889576,developer,"[""USER""]",,active,2021-10-19T08:51:28.385Z,admin,13
62a03f45f90585ab406b89af,UA,health,2022-06-08T06:18:45.358Z,[email protected],2022-06-08T06:19:14.000Z,Margarita Kondratovic,629f514cf90585ab406b6388,$2a$10$52axwmj/beZYqJaPJmK/5.14O0ebTX6o7uYjKq/B4QBPLI7MwjBGa,31629426356,M&E Officer,"[""USER""]",,active,2022-06-08T06:19:14.289Z,m@rgarita,2
629f514cf90585ab406b6389,UA,fsac,2022-06-07T13:23:24.962Z,[email protected],2022-06-07T13:23:24.000Z,Fridon,629f514cf90585ab406b6388,$2a$10$SoZzx3sJBjJBfZNStV3hT.JsVdpht0sUSTKM2uC2vMxyK.Y.nMLLO,995599077208,CP,"[""USER"",""ORG""]",,active,2022-06-07T13:23:24.981Z,fridon,1
62f60115210fc6ee63e4f4bb,UA,health,2022-08-12T07:28:21.147Z,[email protected],2022-08-12T07:28:21.000Z,Syihab,62f60115210fc6ee63e4f4ba,$2a$10$/ZGeUXWergGOq81az5U4kuBeoq7tZ9ZhVeH2RrmC7vGZl0QGeDWre,85643302133,manager,"[""USER"",""ORG""]",,active,2022-08-12T07:28:21.166Z,syihab,1
Expand Down
3 changes: 0 additions & 3 deletions scripts/migrate_mongodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,13 +420,10 @@ def import_beneficiary_types_from_csv(conn, beneficiary_type_csv):
cluster_code = cluster_id[1]

if b_cluster_code == cluster_code:
# print(f"{b_cluster_code} = {cluster_code}")
print(f"cluster_id: {cluster_id[0]} === b_id: {b_id[1]}")
query = f"""
INSERT INTO rh_beneficiarytype_clusters (beneficiarytype_id, cluster_id)
VALUES ((select id from rh_beneficiarytype where code = "{b_id[1]}"),{cluster_id[0]})
"""
print(query)
c.execute(query)

c.execute("DROP TABLE tmp_beneficiarytype;")
Expand Down
4 changes: 2 additions & 2 deletions src/users/templates/users/registration/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ <h1 class="title">Login</h1>
{% csrf_token %}
{% if request.GET.next %}<input type="hidden" name="next" id="rh_next" value="{{ request.GET.next }}" />{% endif %}
<div class="input-field is-required">
<label for="id_email">Email</label>
<label for="id_email">Email/Username</label>
<div class="input-holder">
<input type="email"
<input type="text"
name="email"
id="id_email"
class="form-control"
Expand Down
2 changes: 1 addition & 1 deletion src/users/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def login_view(request):
if request.method == "POST":
email = request.POST["email"]
password = request.POST.get("password")
user = authenticate(request, email=email, password=password)
user = authenticate(request,username=email, email=email, password=password)

if user is not None:
login(request, user)
Expand Down

0 comments on commit 5aa820c

Please sign in to comment.