diff --git a/CHANGELOG.md b/CHANGELOG.md index 273ef2464..a57482988 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Change Log All notable changes to this project will be documented in this file. +## [Unreleased] +### Fixed +- users: Fixed checking restricted usernames. + ## [0.10.0] - 2016-08-12 ### Added - Added Disks module to show free space of mounted partitions and @@ -83,6 +87,7 @@ All notable changes to this project will be documented in this file. - Fixed issue that could allow someone to start a module setup process without being logged in to Plinth. +[Unreleased]: https://github.com/freedombox/Plinth/compare/v0.10.0...HEAD [0.10.0]: https://github.com/freedombox/Plinth/compare/v0.9.4...v0.10.0 [0.9.4]: https://github.com/freedombox/Plinth/compare/v0.9.3...v0.9.4 [0.9.3]: https://github.com/freedombox/Plinth/compare/v0.9.2...v0.9.3 diff --git a/plinth/modules/users/forms.py b/plinth/modules/users/forms.py index a02c8302e..6f733155b 100644 --- a/plinth/modules/users/forms.py +++ b/plinth/modules/users/forms.py @@ -52,12 +52,15 @@ GROUP_CHOICES = ( class ValidNewUsernameCheckMixin(object): """Mixin to check if a username is valid for created new user.""" - def clean(self): + def clean_username(self): """Check for username collisions with system users.""" - if not self.is_valid_new_username(): - raise ValidationError(_('Username is taken or is reserved')) + username = self.cleaned_data['username'] + if self.instance.username != username and \ + not self.is_valid_new_username(): + raise ValidationError(_('Username is taken or is reserved.'), + code='invalid') - return super().clean() + return username def is_valid_new_username(self): """Check for username collisions with system users."""