Changeset 26272
- Timestamp:
- 2012-09-29T13:24:20+12:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/Authentication.java
r26233 r26272 18 18 import javax.mail.Session; 19 19 import javax.mail.Transport; 20 import javax.mail.PasswordAuthentication; 20 21 import javax.mail.internet.AddressException; 21 22 import javax.mail.internet.InternetAddress; … … 627 628 else if (op.equals(PERFORM_RETRIEVE_PASSWORD)) 628 629 { 629 630 630 631 } 631 632 else if (op.equals(PERFORM_CHANGE_PASSWORD)) 632 633 { 634 serviceNode.setAttribute("operation", PERFORM_CHANGE_PASSWORD); 633 635 String user_name = (String) paramMap.get("username"); 634 636 String oldPassword = (String) paramMap.get("oldPassword"); … … 640 642 } 641 643 642 String prevPassword = retrieveDataForUser(user_name, "password"); 643 644 oldPassword = hashPassword(oldPassword); 645 if (!oldPassword.equals(prevPassword)) 644 String prevPassword = retrieveDataForUser(user_name, "password"); 645 if (!hashPassword(oldPassword).equals(prevPassword)) 646 646 { 647 647 addUserInformationToNode(user_name, serviceNode); 648 serviceNode.setAttribute("operation", PERFORM_CHANGE_PASSWORD);649 648 GSXML.addError(this.doc, result, _errorMessageMap.get(ERROR_INCORRECT_PASSWORD), "Incorrect Password"); 650 649 return result; … … 659 658 } 660 659 661 newPassword = hashPassword(newPassword); 662 663 //Get the info of the given user, except for password 664 String prevGroups = retrieveDataForUser(user_name, "groups"); 665 String prevStatus = retrieveDataForUser(user_name, "status"); 666 String comment = "password_changed_by_user"; 667 String prevEmail = retrieveDataForUser(user_name, "email"); 668 669 error = removeUser(user_name); 670 if (error != NO_ERROR) 671 { 672 addUserInformationToNode(user_name, serviceNode); 673 serviceNode.setAttribute("operation", ACCOUNT_SETTINGS); 674 GSXML.addError(this.doc, result, _errorMessageMap.get(error)); 675 676 return result; 677 } 678 679 error = addUser(user_name, newPassword, prevGroups, prevStatus, comment, prevEmail); 680 if (error != NO_ERROR) 681 { 682 GSXML.addError(this.doc, result, _errorMessageMap.get(error)); 683 } 684 685 addUserInformationToNode(null, serviceNode); 686 serviceNode.setAttribute("operation", LIST_USERS); 660 String chpa_groups = retrieveDataForUser(user_name, "groups"); 661 String chpa_comment = "password_changed_by_user"; 662 String info = this._derbyWrapper.modifyUserInfo(user_name, hashPassword(newPassword), chpa_groups, null, chpa_comment, null); 663 if(info != "succeed"){//see DerbyWrapper.modifyUserInfo 664 GSXML.addError(this.doc, result, _errorMessageMap.get(info)); 665 return result; 666 } 687 667 } 688 668 else if (op.equals(EDIT_USER))
Note:
See TracChangeset
for help on using the changeset viewer.