Check password new and confirm password match. If both passwords are not match raise exception. :param data: Data. :param new_data: new data dict.
(data, new_data)
| 569 | |
| 570 | |
| 571 | def validate_password(data, new_data): |
| 572 | """ |
| 573 | Check password new and confirm password match. If both passwords are not |
| 574 | match raise exception. |
| 575 | :param data: Data. |
| 576 | :param new_data: new data dict. |
| 577 | """ |
| 578 | if ('newPassword' in data and data['newPassword'] != "" and |
| 579 | 'confirmPassword' in data and data['confirmPassword'] != ""): |
| 580 | |
| 581 | if data['newPassword'] == data['confirmPassword']: |
| 582 | new_data['password'] = hash_password(normalise_password( |
| 583 | data['newPassword']) |
| 584 | ) |
| 585 | else: |
| 586 | raise InternalServerError(_("Passwords do not match.")) |
| 587 | |
| 588 | |
| 589 | def validate_unique_user(data): |
no test coverage detected