Skip to content

Commit 0ba030e

Browse files
authored
Don't try and encrypt password if none passed (#459)
## Status - Ready for review ## What's changed? - Only try and decrypt the password if a password is passed, since resetting and updating student details use the same endpoint ## Steps to perform after deploying to production N/A
1 parent 1bae868 commit 0ba030e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/concepts/school_student/update.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ def call(school:, student_id:, school_student_params:, token:)
1717

1818
def update_student(school, student_id, school_student_params, token)
1919
username = school_student_params.fetch(:username, nil)
20-
encrypted_password = school_student_params.fetch(:password, nil)
21-
password = DecryptionHelpers.decrypt_password(encrypted_password)
2220
name = school_student_params.fetch(:name, nil)
21+
password = school_student_params.fetch(:password, nil)
22+
password = DecryptionHelpers.decrypt_password(password) if password.present?
2323

2424
validate(username:, password:, name:)
2525

0 commit comments

Comments
 (0)