-
Notifications
You must be signed in to change notification settings - Fork 446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #687 : Basic Login and Register #688
Conversation
Adds User Login and Register functionality to Badgeyay API. Cheers! Adds Git Ignore
def verifyPassword(user, password): | ||
return check_password_hash( | ||
user.password, | ||
password) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no newline at end of file
@@ -0,0 +1,6 @@ | |||
from werkzeug.security import check_password_hash | |||
|
|||
def verifyPassword(user, password): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expected 2 blank lines, found 1
backend/blueprint/api/run.py
Outdated
|
||
app.run() | ||
db.init_app(app) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expected 2 blank lines after class or function definition, found 1
backend/blueprint/api/run.py
Outdated
app.register_blueprint(homePage.router) | ||
app.register_blueprint(errorHandlers.router) | ||
|
||
@app.before_first_request |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expected 2 blank lines, found 1
backend/blueprint/api/models/user.py
Outdated
name = db.Column(db.String(80)) | ||
|
||
|
||
def __init__(self, username, password, name): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
too many blank lines (2)
data['username'], | ||
data['password'], | ||
data['name'] | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
closing bracket does not match indentation of opening bracket's line
|
||
return jsonify( | ||
Response(403).generateMessage( | ||
'No data received')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no newline at end of file
|
||
token = jwt.encode( | ||
{'user' : user.username, | ||
'exp' : datetime.datetime.utcnow() + datetime.timedelta(seconds=900)}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
continuation line under-indented for visual indent
whitespace before ':'
'Wrong username & password combination')) | ||
|
||
token = jwt.encode( | ||
{'user' : user.username, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whitespace before ':'
Response(403).generateMessage( | ||
'Could not find the Username Specified')) | ||
|
||
if not verifyPassword(user,data['password']): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing whitespace after ','
CC : @djmgit @ParthS007 |
Codecov Report
@@ Coverage Diff @@
## development #688 +/- ##
==========================================
Coverage 100% 100%
==========================================
Files 1 1
Lines 43 43
==========================================
Hits 43 43 Continue to review full report at Codecov.
|
data['name']) | ||
|
||
try: | ||
newUser.save_to_db() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trailing whitespace
return check_password_hash( | ||
user.password, | ||
password) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blank line at end of file
return jsonify( | ||
Response(403).generateMessage( | ||
'No data received')) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blank line at end of file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nicely done 👍
Please solve the hound errors
backend/blueprint/api/db.py
Outdated
from flask_sqlalchemy import SQLAlchemy | ||
|
||
db = SQLAlchemy() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blank line at end of file
30e11eb
to
4e7bdf4
Compare
Fixes Hound2 Fixes Hound3 Fixes Hound4 Fixes Hound
db11386
to
83e0b8b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is nice to start with. In further iterations we can decide what fields need to present while registration. We can collect email and other stuff, need to discuss on that. Also other stuff like restrictions on password, email check, etc.
Sure @djmgit your views : @djmgit @ParthS007 ? |
@yashLadha (unable to tag you from reviewers list, don't know why :P) @ParthS007 please review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Fixes #687
Checklist
development
branch.Preview Link
Changes proposed in this pull request: