Giter Club home page Giter Club logo

kaseq4-recipebox's Introduction

Authentication!

Due Friday by 11:59pm Points 20 Submitting a website url Available May 6 at 10:30am - May 11 at 11:59pm 6 days

Django helps us out with a ton of stuff when it comes to starting a website, and authentication is no exception. By hooking into the backend for the admin panel and the helper functions that it gives us, we can roll our own authentication system fairly easily with only a few changes. Your Task

Note: Make sure you create a new branch off of the dev/forms branch we created in the last assessment. Perhaps name it dev/auth.

The goal of this assignment is to modify your recipe application to be able to protect those forms; we don't want just anyone adding recipes!

Update the Author model to have a 1-to-1 relationship with the built-in Django User model.
    Resources
        https://docs.djangoproject.com/en/3.0/ref/contrib/auth/#user-model (Links to an external site.)Links to an external site.
        https://docs.djangoproject.com/en/3.0/topics/db/examples/one_to_one/ (Links to an external site.)Links to an external site.
Extend the AddAuthorForm so that we pass usernames and passwords in for user and author accounts to be created.
Add a login page so that people can sign in.
use the @login_required() decorator to lock your form views so that only logged in users can access them... but set them so that they require different permissions to access.
    The AddRecipeForm can be accessed by any logged in user.
    The AddAuthorForm can only be accessed by admins.
        (Hint: check the flag at `request.user.is_staff`)
On your homepage, add a logout button that completes the logout process and dumps the user back on the homepage.

Extra credit, 5 points:

Make the recipe creation page change the Author attribute depending on whether or not the logged-in user is staff or not. If they are staff, list all available Authors as options. If they are not staff, make it so that they can only submit recipes as themselves.

Demo Video: https://s3.us-east-2.amazonaws.com/videos.kenzie.academy/Software+Engineering+-+Python/2020-02-05+--+Django+Auth.mp4 (Links to an external site.)Links to an external site. Submission

Submit a link to the branch on your repository

https://github.com/<github_username>/<repo_name>/tree/<branch_name>

Rubric auuuuth auuuuth Criteria Ratings Pts This criterion is linked to a Learning Outcome Login portal at /login/ 2.0 pts Full Marks 0.0 pts No Marks 2.0 pts This criterion is linked to a Learning Outcome logout link at /logout/ 2.0 pts Full Marks 0.0 pts No Marks 2.0 pts This criterion is linked to a Learning Outcome Clicking on either form when not logged in redirects to login page 2.0 pts Full Marks 0.0 pts No Marks 2.0 pts This criterion is linked to a Learning Outcome After logging in, user is redirected back to form that was originally requested 2.0 pts Full Marks 0.0 pts No Marks 2.0 pts This criterion is linked to a Learning Outcome staff users can create authors and create recipes 2.0 pts Full Marks 0.0 pts No Marks 2.0 pts This criterion is linked to a Learning Outcome non-staff users can create recipes but receive an error when they try to access the author creation page 2.0 pts Full Marks 0.0 pts No Marks 2.0 pts This criterion is linked to a Learning Outcome Login url is stored in settings.py 2.0 pts Full Marks 0.0 pts No Marks 2.0 pts This criterion is linked to a Learning Outcome logout button functions as expected and redirects back to the homepage afterwards 2.0 pts Full Marks 0.0 pts No Marks 2.0 pts This criterion is linked to a Learning Outcome E.C. (5 points): Make the recipe creation page change the Author attribute depending on whether or not the logged-in user is staff or not. If they are staff, list all available Authors as options. If they are not staff, make it so that they can only submit recipes as themselves. 0.0 pts Full Marks 0.0 pts No Marks 0.0 pts This criterion is linked to a Learning Outcome Repo contains pyproject.toml that includes all necessary dependencies to run application 2.0 pts Full Marks 0.0 pts No Marks 2.0 pts This criterion is linked to a Learning Outcome Author model has 1-to-1 relationship with Auth User 2.0 pts Full Marks 0.0 pts No Marks 2.0 pts Total Points: 20.0

kaseq4-recipebox's People

Contributors

techieben avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.