-
Notifications
You must be signed in to change notification settings - Fork 1
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
James #11
base: master
Are you sure you want to change the base?
Conversation
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.
Please fix style errors.
Will also need to figure out merge conflicts with @anhphung97's PR>
URL = 'doc.json' | ||
db_users = handle.users_database | ||
|
||
class Course: |
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.
If you want an ODM layer to automatically translate Python class
es into Mongo documents, I recommend mongoengine. It'll be a lot easier than rolling your own custom thing.
app = Flask(__name__) | ||
URL = 'doc.json' |
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.
Why is this called URL
?
if not posts.find_one({"call_number": course["CallNumber"]}): | ||
units = course["NumFixedUnits"] | ||
if units: | ||
units = "{}.{}".format(units[1], units[2]) |
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.
What's going on here?
|
||
""" | ||
|
||
return "loaded" |
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.
What's going on with this function?
app = Flask(__name__) | ||
URL = 'doc.json' | ||
db_users = handle.users_database |
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 🙅. The users_database
is meant for authenticating access to mongo itself, not for authenticating users to the app. I would recommend looking into WTForms
or something for the password authentication (or better yet, just use OAuth).
|
||
def is_correct_password(name, password): | ||
user = db_users.login_info.find_one({"username" : name}) | ||
if 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.
🙅 Never store passwords as plaintext.
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.
would recommend using bcrypt before storing your passwords
https://pypi.python.org/pypi/bcrypt/3.1.0
added backend functionality and some extra testing functions