Skip to content

Commit

Permalink
Auth flow (#4)
Browse files Browse the repository at this point in the history
* fix launch

* create run script

* clean codeforlife in yarn cache

* fix paths

* quick save

* fix api

* teacher email form

* optimize deps

* otp form

* otp bypass token form

* indy form

* add login forms

* save lock

* verify email address notification

* auto log in student

* fix path

* fix csrf and login redirect to dashboard

* sync config

* redirect teacher to otp form if pending

* update lock

* delete duplicate utils

* add dummy tests

* fix api arg

* delete unused file

* use new js package

* use new package

* feedback

* fix log out
  • Loading branch information
SKairinos committed Jun 19, 2024
1 parent ea2a05a commit 7540b2f
Show file tree
Hide file tree
Showing 53 changed files with 1,198 additions and 985 deletions.
2 changes: 1 addition & 1 deletion .devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"source=./codeforlife-package-python,target=/workspace/codeforlife-package-python,type=bind,consistency=cached"
],
"name": "portal-frontend",
"postCreateCommand": "sudo chmod u+x ./setup && ./setup",
"postCreateCommand": "sudo chmod u+x scripts/setup && scripts/setup",
"remoteUser": "root",
"service": "base-service",
"shutdownAction": "none",
Expand Down
3 changes: 2 additions & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
VITE_API_BASE_URL=REPLACE_ME
VITE_API_BASE_URL=http://localhost:8000/api/
VITE_SERVICE_NAME=portal
2 changes: 1 addition & 1 deletion .gcloudignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/codecov.yml
/*.code-*
/*.md
/setup
/scripts
/tsconfig.json
/tsconfig.node.json
/vite.config.ts
Expand Down
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"configurations": [
{
"name": "React Dev Server",
"preLaunchTask": "start-react-dev-server",
"name": "Vite Server",
"preLaunchTask": "start-vite-server",
"request": "launch",
"type": "chrome",
"url": "http://localhost:5173"
Expand Down
12 changes: 9 additions & 3 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
{
"tasks": [
{
"command": "sudo chmod u+x scripts/hard-install && scripts/hard-install",
"label": "hard-install",
"problemMatcher": [],
"type": "shell"
},
{
"command": "sudo chmod u+x scripts/run && scripts/run",
"isBackground": true,
"label": "start-react-dev-server",
"label": "start-vite-server",
"options": {
"env": {
"BROWSER": "none"
}
},
"problemMatcher": [],
"script": "start",
"type": "npm"
"type": "shell"
}
],
"version": "2.0.0"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"//": "🚫 Don't add `dependencies` below that are inherited from the CFL package.",
"dependencies": {
"codeforlife": "github:ocadotechnology/codeforlife-package-javascript#v2.0.0"
"codeforlife": "github:ocadotechnology/codeforlife-package-javascript#v2.0.3"
},
"//": "✅ Do add `devDependencies` below that are `peerDependencies` in the CFL package.",
"devDependencies": {
Expand Down
9 changes: 9 additions & 0 deletions scripts/hard-install
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
set -e

cd "${BASH_SOURCE%/*}"

rm -f ../yarn.lock
rm -rf ../node_modules
yarn cache clean codeforlife
yarn install --production=false
8 changes: 8 additions & 0 deletions scripts/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
set -e

cd "${BASH_SOURCE%/*}"

source ./setup

yarn dev
2 changes: 0 additions & 2 deletions setup → scripts/setup
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ set -e

cd "${BASH_SOURCE%/*}"

printf "Setting up Node.js environment\n\n"

yarn install --production=false
39 changes: 0 additions & 39 deletions src/App.css

This file was deleted.

105 changes: 0 additions & 105 deletions src/App.test.tsx

This file was deleted.

72 changes: 10 additions & 62 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,67 +1,15 @@
import "./App.css"
import { Counter } from "./features/counter/Counter"
import { Quotes } from "./features/quotes/Quotes"
import logo from "./logo.svg"
import { CssBaseline, ThemeProvider } from "@mui/material"
import type { FC } from "react"

const App = () => {
import theme from "./app/theme"
import Router from "./router"

const App: FC = () => {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<Counter />
<p>
Edit <code>src/App.tsx</code> and save to reload.
</p>
<Quotes />
<span>
<span>Learn </span>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
React
</a>
<span>, </span>
<a
className="App-link"
href="https://redux.js.org"
target="_blank"
rel="noopener noreferrer"
>
Redux
</a>
<span>, </span>
<a
className="App-link"
href="https://redux-toolkit.js.org"
target="_blank"
rel="noopener noreferrer"
>
Redux Toolkit
</a>
<span>, </span>
<a
className="App-link"
href="https://react-redux.js.org"
target="_blank"
rel="noopener noreferrer"
>
React Redux
</a>
,<span> and </span>
<a
className="App-link"
href="https://reselect.js.org"
target="_blank"
rel="noopener noreferrer"
>
Reselect
</a>
</span>
</header>
</div>
<ThemeProvider theme={theme}>
<CssBaseline />
<Router />
</ThemeProvider>
)
}

Expand Down
2 changes: 1 addition & 1 deletion src/api/authFactor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
type DestroyResult,
type ListArg,
type ListResult,
} from "codeforlife/utils/rtkQuery"
} from "codeforlife/utils/api"

import api from "."

Expand Down
Loading

0 comments on commit 7540b2f

Please sign in to comment.