Fix broken implementation of import_from_firstuse
#221
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This would fix #219 when using c.NativeAuthenticator.import_from_firstuse = True:
When importing users from passwords.dbm, the hashed password was processed as if it was a cleartext password, leading the original password to fail and preventing imported users from logging in.
An extra keyword option "from_firstuse" was added to create_user() to handle this special case.
The code also silently skips existing users on import to avoid overwriting their password.
This is to handle the case when users do not wish to delete their FirstUseAuthenticator database after the first import, in which case the re-import at each hub reload could cause any password changes done after to be overwritten, or constant reload failures.
Note about password checks on import:
The FirstUse Authenticator stores hashed passwords, so checking if they are based on common passwords would be quite time consuming. So the import only checks for valid usernames, not if the passwords are long enough or common.