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

HER-31: fix devise JWT #20

Merged
merged 2 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@

# Ignore master key for decrypting credentials and more.
/config/master.key
/config/master.key.bak
/config/credentials.yml.enc.bak


# Ignore node modules
node_modules
18 changes: 4 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,39 +50,29 @@ This app provides teachers with resources to support social-emotional learning f
npm install
```

7. In the project files, delete the `config/credentials.yml.enc` file. Then, in the `rails server` terminal, run the following:

```sh
EDITOR="code --wait" bin/rails credentials:edit
```

This will open a file in VSCode. Close this file without changes. This will re-create the credential files for your local environment.

You should see both the `credentials.yml.enc` and `master.key` files in the `config` folder.

8. In `rails server`, create and seed the database:
7. In `rails server`, create and seed the database:

```sh
rails db:prepare
```

9. Start `rails server`
8. Start `rails server`

```sh
rails s
```

> The backend server runs on `localhost:3000`

10. Start `frontend`
9. Start `frontend`

```sh
npm run dev
```

> The frontend server runs on `localhost:5173`

11. Open `http://localhost:5173/` and get coding!
10. Open `http://localhost:5173/` and get coding!

## Features

Expand Down
3 changes: 3 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ class Application < Rails::Application
# Only loads a smaller set of middleware suitable for API only apps.
# Middleware like session, flash, cookies can be added back manually.
# Skip views, helpers and assets when generating a new resource.
config.middleware.use ActionDispatch::Cookies
config.middleware.use ActionDispatch::Session::CookieStore

config.api_only = true
end
end
1 change: 0 additions & 1 deletion config/credentials.yml.enc

This file was deleted.

1 change: 0 additions & 1 deletion config/credentials.yml.enc.bak

This file was deleted.

3 changes: 1 addition & 2 deletions config/initializers/devise.rb
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,7 @@

# ==> Configuration for :registerable

jwt_secret = ENV["DEVISE_JWT_SECRET_KEY"] || SecureRandom.hex(20) unless Rails.env.production?
jwt_secret ||= Rails.application.credentials.fetch(:secret_key_base)
jwt_secret = ENV.fetch("DEVISE_JWT_SECRET_KEY") { "713135daf69a905f3b1e3758ac144401c78a5c66553c845871998f1386c5b48869b043c3e50e45b63acba54daf1005004f9a38b7bdd6d6aa5e11181940b2564d" }

# When set to false, does not sign a user in automatically after their password is
# changed. Defaults to true, so a user is signed in automatically after changing a password.
Expand Down
1 change: 0 additions & 1 deletion config/master.key.bak

This file was deleted.

61 changes: 8 additions & 53 deletions frontend/node_modules/.package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

79 changes: 0 additions & 79 deletions frontend/node_modules/.vite/deps/_metadata.json

This file was deleted.

Loading