1
0
Fork 0
forked from s3lph/matemat

Merge branch 'staging' into 'master'

Fixed: 500 Internal Server Error on password change with wrong original password.

See merge request s3lph/matemat!59
This commit is contained in:
s3lph 2019-02-08 04:14:24 +00:00
commit 6225063ea6
3 changed files with 20 additions and 3 deletions

View file

@ -1,5 +1,19 @@
# Matemat Changelog # Matemat Changelog
<!-- BEGIN RELEASE v0.1.1 -->
## Version 0.1.1
Minor bugfix release.
### Changes
<!-- BEGIN CHANGES 0.1.1 -->
- Fixed: 500 Error when attempting to change the password with a wrong old password.
<!-- END CHANGES 0.1.1 -->
<!-- END RELEASE v0.1.1 -->
<!-- BEGIN RELEASE v0.1 --> <!-- BEGIN RELEASE v0.1 -->
## Version 0.1 ## Version 0.1

View file

@ -1,2 +1,2 @@
__version__ = '0.1' __version__ = '0.1.1'

View file

@ -10,7 +10,7 @@ from matemat.webserver import pagelet, RequestArguments, PageletResponse, Redire
from matemat.util.currency_format import parse_chf from matemat.util.currency_format import parse_chf
from matemat.db import MatematDatabase from matemat.db import MatematDatabase
from matemat.db.primitives import User, ReceiptPreference from matemat.db.primitives import User, ReceiptPreference
from matemat.exceptions import DatabaseConsistencyError, HttpException from matemat.exceptions import AuthenticationError, DatabaseConsistencyError, HttpException
@pagelet('/admin') @pagelet('/admin')
@ -101,7 +101,10 @@ def handle_change(args: RequestArguments, user: User, db: MatematDatabase, confi
if newpass != newpass2: if newpass != newpass2:
raise ValueError('New passwords don\'t match') raise ValueError('New passwords don\'t match')
# Write the new password to the database # Write the new password to the database
db.change_password(user, oldpass, newpass) try:
db.change_password(user, oldpass, newpass)
except AuthenticationError:
raise ValueError('Old password doesn\'t match')
# The user requested a touchkey change # The user requested a touchkey change
elif change == 'touchkey': elif change == 'touchkey':