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

Migrate to pow #654

Merged
merged 32 commits into from
Nov 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
5264743
add mailer and email templates
eliknebel Oct 15, 2020
22ae8bf
Merge branch 'master' of github.com:Simon-Initiative/oli-torus into e…
eliknebel Oct 20, 2020
10ad798
add pow support CHECKPOINT
eliknebel Oct 20, 2020
fc43463
remove comments, unused code
eliknebel Oct 20, 2020
5626b55
Add JS client side refresh to fix live view issues (danschultzer/pow#…
eliknebel Oct 21, 2020
7bc17e5
convert user sessions to use pow
eliknebel Oct 22, 2020
0377d65
fix link account functionality
eliknebel Oct 22, 2020
51b2577
reenable social media login using pow_assent
eliknebel Oct 23, 2020
638e3ff
add password reset and email confirmation
eliknebel Oct 23, 2020
a2da7e2
add prod configs for email
eliknebel Oct 23, 2020
dd48b70
add persistent sessions
eliknebel Oct 26, 2020
255fb08
replace facebook login with github
eliknebel Oct 26, 2020
950bc4e
Merge branch 'master' of github.com:Simon-Initiative/oli-torus into m…
eliknebel Oct 27, 2020
2e60e9c
fix merge
eliknebel Oct 27, 2020
58e7d20
update account page, edit details
eliknebel Oct 27, 2020
2bc73a8
use OIDC standards for name
eliknebel Oct 27, 2020
c6dfcb9
add name and picture fields to author from oidc
eliknebel Oct 28, 2020
52ffa28
CHECKPOINT
eliknebel Oct 28, 2020
b6139bb
fix link account issue
eliknebel Oct 29, 2020
8aebe7a
fix after_sign_in_path route issue
eliknebel Oct 29, 2020
a53cd40
re-enable captcha
eliknebel Oct 29, 2020
2d0a977
fix account link fails when user input has an error or redirect to ot…
eliknebel Oct 30, 2020
0c12f33
resolve ses issue with ex_aws
eliknebel Oct 30, 2020
cdf29f4
fix an issue with update author details
eliknebel Oct 30, 2020
3e49274
remove unnecessary dependency
eliknebel Nov 1, 2020
2fac9ea
fix unit tests
eliknebel Nov 2, 2020
f4156b2
add enhanced coverage reporting
eliknebel Nov 3, 2020
3fddc73
add coveralls to github workflow
eliknebel Nov 3, 2020
22b7a66
add more tests for delivery_controller
eliknebel Nov 4, 2020
4a06464
Merge branch 'master' of github.com:Simon-Initiative/oli-torus into m…
eliknebel Nov 4, 2020
b24b0a0
spelling
eliknebel Nov 4, 2020
2d8316a
fix non-deterministic failing unit test
eliknebel Nov 4, 2020
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
8 changes: 6 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ jobs:
elixir-build-test:
runs-on: ubuntu-latest

env:
MIX_ENV: test
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- name: 🛎️ Checkout
uses: actions/checkout@v2
Expand All @@ -36,8 +40,8 @@ jobs:
- name: 🔨 Build project
run: set -a;source oli.env && mix clean && mix compile --warnings-as-errors

- name: ️ Run tests
run: set -a;source oli.env && mix test.coverage
- name: ️ Run tests
run: set -a;source oli.env && mix coveralls.github

ts-build-test:
runs-on: ubuntu-latest
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/static/images/oli-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

.signin {
.form-container {
--input-padding-x: 1.5rem;
--input-padding-y: .75rem;

Expand All @@ -23,6 +23,12 @@
font-weight: bold;
transition: all 0.2s;
text-transform: uppercase;
background-color: $secondary;
color: $white;

&:hover {
background-color: darken($secondary, 10%);
}
}

.form-label-group {
Expand Down Expand Up @@ -94,26 +100,54 @@

a.btn-google:hover {
color: white;
background-color: #ea4335;
background-color: #c0382c;
}

.btn-facebook {
.btn-github {
color: white;
background-color: #3b5998;
background-color: #24292e;
}

a.btn-facebook:hover {
a.btn-github:hover {
color: white;
background-color: #3b5998;
background-color: #000000;
}

// .btn-identity {
// color: white;
// background-color: #3b5998;
// }
}

.provider {
font-size: 80%;
letter-spacing: .1rem;
font-weight: bold;
transition: all 0.2s;
text-transform: uppercase;
line-height: 1.5;
border-radius: 0.25rem;
padding: 0.375rem 2rem;
text-align: center;
vertical-align: middle;
user-select: none;
}

.provider-google {
color: white !important;
background-color: #ea4335 !important;

&.btn {
&:hover {
background-color: darken(#ea4335, 10%) !important;
}
}
}

.provider-github {
color: white !important;
background-color: #24292e !important;

&.btn {
&:hover {
background-color: darken(#24292e, 10%) !important;
}
}
}

// a.btn-identity:hover {
// color: white;
// background-color: #3b5998;
// }
}
2 changes: 2 additions & 0 deletions assets/styles/delivery/form-container.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/** use same styles defined in authoring **/
@import '../authoring/form-container.scss';
4 changes: 4 additions & 0 deletions assets/styles/delivery/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ main.container {
margin-top: 20px;
}

form .form-label-group .help-block {
color: #dc3545;
}

.activity-purpose {
text-transform: uppercase;
background-color: orangered;
Expand Down
119 changes: 0 additions & 119 deletions assets/styles/delivery/signin.scss

This file was deleted.

62 changes: 42 additions & 20 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@ config :oli,
env: Mix.env,
},
local_activity_manifests: Path.wildcard(File.cwd! <> "/assets/src/components/activities/*/manifest.json")
|> Enum.map(&File.read!/1)
|> Enum.map(&File.read!/1),
email_from_name: System.get_env("EMAIL_FROM_NAME", "OLI Torus"),
email_from_address: System.get_env("EMAIL_FROM_ADDRESS", "[email protected]"),
email_reply_to: System.get_env("EMAIL_REPLY_TO", "[email protected]")

# Configures the endpoint
config :oli, OliWeb.Endpoint,
live_view: [signing_salt: System.get_env("LIVE_VIEW_SALT") || "LIVE_VIEW_SALT"],
live_view: [signing_salt: System.get_env("LIVE_VIEW_SALT", "LIVE_VIEW_SALT")],
url: [host: "localhost"],
secret_key_base: "GE9cpXBwVXNaplyUCYbIWqERmC/OlcR5iVMwLX9/W7gzQRxkD1ETjda9E0jW/BW1",
render_errors: [view: OliWeb.ErrorView, accepts: ~w(html json)],
Expand All @@ -46,26 +49,45 @@ config :logger, :console,
# Use Jason for JSON parsing in Phoenix
config :phoenix, :json_library, Jason

# Configure OAuth
config :ueberauth, Ueberauth,
providers: [
google: {Ueberauth.Strategy.Google, [default_scope: "email profile", callback_params: ["type"]]},
facebook: {Ueberauth.Strategy.Facebook, [default_scope: "email,public_profile", callback_params: ["type"]]},
identity: {Ueberauth.Strategy.Identity, [
callback_methods: ["POST"],
uid_field: :email,
request_path: "/auth/identity",
callback_path: "/auth/identity/callback",
]}
config :oli, :pow,
repo: Oli.Repo,
user: Oli.Accounts.Author,
current_user_assigns_key: :current_author,
session_key: "author_auth",
web_module: OliWeb,
routes_backend: OliWeb.Pow.AuthorRoutes,
plug: Pow.Plug.Session,
extensions: [PowResetPassword, PowEmailConfirmation, PowPersistentSession],
controller_callbacks: Pow.Extension.Phoenix.ControllerCallbacks,
mailer_backend: OliWeb.Pow.Mailer,
web_mailer_module: OliWeb,
pow_assent: [
providers: [
google: [
client_id: System.get_env("GOOGLE_CLIENT_ID"),
client_secret: System.get_env("GOOGLE_CLIENT_SECRET"),
strategy: Assent.Strategy.Google,
authorization_params: [
scope: "email profile"
],
session_params: ["type"]
],
github: [
client_id: System.get_env("GITHUB_CLIENT_ID"),
client_secret: System.get_env("GITHUB_CLIENT_SECRET"),
strategy: Assent.Strategy.Github,
authorization_params: [
scope: "read:user user:email"
],
session_params: ["type"]
]
]
]

config :ueberauth, Ueberauth.Strategy.Google.OAuth,
client_id: System.get_env("GOOGLE_CLIENT_ID"),
client_secret: System.get_env("GOOGLE_CLIENT_SECRET")

config :ueberauth, Ueberauth.Strategy.Facebook.OAuth,
client_id: System.get_env("FACEBOOK_CLIENT_ID"),
client_secret: System.get_env("FACEBOOK_CLIENT_SECRET")
if Mix.env == :dev do
config :mix_test_watch,
clear: true
end

# Import environment specific config. This must remain at the bottom
# of this file so it overrides the configuration defined above.
Expand Down
7 changes: 7 additions & 0 deletions config/dev.exs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ config :oli, Oli.Repo,
show_sensitive_data_on_connection_error: true,
pool_size: 10

# Configure email for development
config :oli, Oli.Mailer,
adapter: Bamboo.LocalAdapter

config :oli, OliWeb.Pow.Mailer,
adapter: Bamboo.LocalAdapter

force_ssl = case System.get_env("FORCE_SSL", "true") do
"true" -> [rewrite_on: [:x_forwarded_proto]]
_ -> false
Expand Down
7 changes: 7 additions & 0 deletions config/prod.exs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ config :oli, OliWeb.Endpoint,
# Do not print debug messages in production
config :logger, level: :info

# Configure email for production
config :oli, Oli.Mailer,
adapter: Bamboo.SesAdapter

config :oli, OliWeb.Pow.Mailer,
adapter: Bamboo.SesAdapter

# ## SSL Support
#
# To get SSL working, you will need to add the `https` key
Expand Down
26 changes: 19 additions & 7 deletions config/releases.exs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ host =
For example: host.example.com
"""

# General OLI app config
config :oli,
email_from_name: System.get_env("EMAIL_FROM_NAME", Application.fetch_env!(:oli, :email_from_name)),
email_from_address: System.get_env("EMAIL_FROM_ADDRESS", Application.fetch_env!(:oli, :email_from_address)),
email_reply_to: System.get_env("EMAIL_REPLY_TO", email_from)

# Configure reCAPTCHA
config :oli, :recaptcha,
verify_url: "https://www.google.com/recaptcha/api/siteverify",
Expand All @@ -51,13 +57,19 @@ config :oli, OliWeb.Endpoint,
live_view: [signing_salt: live_view_salt]

# OAuth secrets need to be loaded at runtime
config :ueberauth, Ueberauth.Strategy.Google.OAuth,
client_id: System.get_env("GOOGLE_CLIENT_ID"),
client_secret: System.get_env("GOOGLE_CLIENT_SECRET")

config :ueberauth, Ueberauth.Strategy.Facebook.OAuth,
client_id: System.get_env("FACEBOOK_CLIENT_ID"),
client_secret: System.get_env("FACEBOOK_CLIENT_SECRET")
config :oli, :pow,
pow_assent: [
providers: [
google: [
client_id: System.get_env("GOOGLE_CLIENT_ID"),
client_secret: System.get_env("GOOGLE_CLIENT_SECRET")
],
github: [
client_id: System.get_env("GITHUB_CLIENT_ID"),
client_secret: System.get_env("GITHUB_CLIENT_SECRET")
]
]
]

# Configure Joken, we can just reuse the secret key base
config :joken, default_signer: secret_key_base
Expand Down
Loading