Skip to content
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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

James #11

wants to merge 8 commits into from

Conversation

j-w-shin
Copy link
Contributor

added backend functionality and some extra testing functions

Copy link

@alanhdu alanhdu left a 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:
Copy link

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 classes into Mongo documents, I recommend mongoengine. It'll be a lot easier than rolling your own custom thing.

app = Flask(__name__)
URL = 'doc.json'
Copy link

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])
Copy link

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"
Copy link

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
Copy link

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:
Copy link

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.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants