Created attachment 83 [details] Login successfully before resetting password
Created attachment 84 [details] New passsword login unsuccessfully
Steps to reproduce: Step 1: Log in to the system with the original password "pwd". Step 2: Reset the password as "newPwd". Step 3: End the program. Step 4: Re-login to the system with the new password "newPwd", unsuccessfully. Step 5: Re-login to the system with the original password "pwd", successfully. Actual result: the new password is invalid. Expected result: the new password should be valid to log in to the system.
Reason: JsonOperation.resetPwd: JSONObject memberInfo = getMemberInfo(email); memberInfo.replace("password", pwd); Here we changed the JSONObject, but the JSON file has not been midified. We need to write in and update the JSON file. Solution: JsonOperation.updateJsonFile: File memberListFile = new File("docs\\MemberInfo.json"); FileOutputStream fos = new FileOutputStream(memberListFile, true); OutputStreamWriter osw = new OutputStreamWriter(fos, "UTF-8"); JsonOperation.clearJsonFile(); osw.write(getWholeObjectString()); osw.close(); We add this updateJsonFile method at the end of the resetPwd method. The the problem is resolved. Furthermore, we add this updateJsonFile component at every method which will focus on changing the content of JSO files (JsonOperation.deleteMemberBookmark, JsonOperation.addNewMember, JsonOperation.addNewSchedule, etc.)