lingthio / Flask-User

Customizable User Authorization & User Management: Register, Confirm, Login, Change username/password, Forgot password and more.
http://flask-user.readthedocs.io/
MIT License
1.06k stars 292 forks source link

refactored username and password validators to use regex #199

Closed asoderman closed 6 years ago

asoderman commented 6 years ago

I implemented regex pattern matching for username and password validators. This should be more efficient and also results in less lines of code.

Relevant issue #198

codecov-io commented 6 years ago

Codecov Report

:exclamation: No coverage uploaded for pull request base (master@62b953b). Click here to learn what that means. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #199   +/-   ##
=========================================
  Coverage          ?   93.71%           
=========================================
  Files             ?       24           
  Lines             ?     1368           
  Branches          ?        0           
=========================================
  Hits              ?     1282           
  Misses            ?       86           
  Partials          ?        0
Impacted Files Coverage Δ
flask_user/user_manager.py 89.67% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 62b953b...92c6a00. Read the comment docs.

lingthio commented 6 years ago

I'm torn on this issue. Your code is beautifully compact. I, however, am not fluent in Regex expressions, and from my experience, not many developers are. I have a very hard time even reading your expressions, let alone having to write one. When I look at the current Python code, I imagine that any Python developer can read, understand, and modify. I lean towards valuing readability over compactness in this case.

As a compromise, I will add your code to the code base as a comment. Thanks!