Skip to content
This repository was archived by the owner on Mar 20, 2019. It is now read-only.
This repository was archived by the owner on Mar 20, 2019. It is now read-only.

[Test Post] Access to a running Whenbot app must be password protected #1

@M7

Description

@M7

Since Whenbot will be hosted on Heroku, the app itself should be protected by a login and password.

As Tristan suggested below, we'll be going with a single password field for authentication.

Requirements

  1. When the User runs the install command, they're asked to include their password.
    • E.g. rails generate whenbot:install --password=my_password
  2. There should be a method that can be run as a before_filter in the controllers to ensure that a user is logged in.
  3. When the User visits any page without an active, authenticated session, they are redirected to an unlock page that requests their password.
  4. The password must be encrypted when stored in the database.
  5. Bonus: Allow the user to also include their email address during setup, so that Whenbot can email the User if needed.
    • E.g. rails generate whenbot:install --email=me@example.com --password=my_password

Feel free to ask any questions that you may have.

This feature should be developed via Test Driven Development. Either way, a proper set of tests is required for this to be pulled into the main repository.

Contributing

If you'd like to work on this, and no-one else has assigned this task to themselves yet, assign this task to yourself. You can do this by clicking the gear icon beside the "No on is assigned" text above, and selecting your name.

If someone else beat you to it, do not reassign the task to yourself. Instead, check the comments (below) to see if they added a comment that says "Accepting teammates."

If you see "Accepting teammates" and would to join in, add a post here to say so and connect. You can also try reaching out to the original assignee via a private message or email.

Working in pairs or teams is encouraged. If you managed to snag this task by being the first to assign it to yourself, consider working with a teammate or two. To let people know you'd like to team up, add a comment below saying "Accepting teammates."

Keep an eye on new comments for this task, there may be someone reaching out to work with you.

Implementation

This can be implemented anyway you want. You may choose to use a pre-existing solution, such as Devise, or roll your own.

If you're interested in writing password protected login from scratch, read sections 7.1 and 7.2 of the Rails Tutorial Book for some hints.

You may want to supplement it with this section of the Rails Tutorial book, ignoring the parts about the username and email. It will walk you through creating a user account.

Testing hints:

Here's a few test ideas to get you started:

  1. Write a test that
    1. Gets the /whenbot/tasks/ page
    2. Asserts that you're redirected to the login page
  2. Run the tests, make sure it fails.
  3. Implement the code needed to make the test pass
  4. Write a Capybara test that
    1. Visits the /whenbot/tasks/without signing in
    2. Checks that you're redirected to page that has the content "Enter Password"
    3. Fill in the password field with your password (set via a Factory)
    4. Clicks on the "Sign In" button
    5. Checks that you're successfully logged in and brought to the /whenbot/tasks/ page
  5. Run the tests, make sure it fails.
  6. Implement the code needed to make the test pass
  7. Write a test that
    1. Logs into a User's account
    2. Visits the /whenbot/tasks/new page
    3. Asserts that you're not redirected away from the /whenbot/tasks/new page
    4. Asserts that the page contains text that says "Trigger Channel" (as in "Choose a Trigger Channel")
  8. Run the test, make sure it fails
  9. Write the code needed to make the test pass
  10. Add in any other functionality using TDD.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions