diff options
Diffstat (limited to 'blocks')
-rw-r--r-- | blocks/.dockerignore | 5 | ||||
-rw-r--r-- | blocks/Dockerfile | 3 | ||||
-rw-r--r-- | blocks/Dockerfile.patch | 10 | ||||
-rw-r--r-- | blocks/blocks/settings.py | 1 | ||||
-rw-r--r-- | blocks/eda-frontend/.babelrc.json | 3 | ||||
-rw-r--r-- | blocks/eda-frontend/src/redux/authSlice.js | 10 | ||||
-rwxr-xr-x | blocks/init.sh | 6 |
7 files changed, 18 insertions, 20 deletions
diff --git a/blocks/.dockerignore b/blocks/.dockerignore index 5e6b38b0..6de483dd 100644 --- a/blocks/.dockerignore +++ b/blocks/.dockerignore @@ -9,8 +9,11 @@ env* *.sqlite3 *.swp .DS_Store -**/.env +.env **/.env.* +**/.git* +**/.nvmrc +**/.vscode **/build **/node_modules tags diff --git a/blocks/Dockerfile b/blocks/Dockerfile index f8bfc6ae..d5d630ca 100644 --- a/blocks/Dockerfile +++ b/blocks/Dockerfile @@ -121,9 +121,6 @@ COPY . . # Configure venv and sqlite3 RUN ./install.sh -# For localhost only -RUN echo 'WDS_SOCKET_PORT=80' > eda-frontend/.env.local - # Cleanup RUN apt-get autoremove -qq --purge gawk python3-pip python3-venv wget xz-utils RUN apt-get clean -qq diff --git a/blocks/Dockerfile.patch b/blocks/Dockerfile.patch index 0a94dd1c..069a62cc 100644 --- a/blocks/Dockerfile.patch +++ b/blocks/Dockerfile.patch @@ -1,5 +1,5 @@ ---- Dockerfile 2025-07-04 16:16:28.040919228 +0530 -+++ Dockerfile.1 2025-07-04 16:19:16.930142599 +0530 +--- Dockerfile 2025-07-08 18:20:34.818712259 +0530 ++++ Dockerfile.1 2025-07-08 18:21:40.192702872 +0530 @@ -119,7 +119,7 @@ COPY . . @@ -7,9 +7,9 @@ -RUN ./install.sh +RUN ./install.sh prod - # For localhost only - RUN echo 'WDS_SOCKET_PORT=80' > eda-frontend/.env.local -@@ -173,4 +173,4 @@ + # Cleanup + RUN apt-get autoremove -qq --purge gawk python3-pip python3-venv wget xz-utils +@@ -170,4 +170,4 @@ WORKDIR ${XCOS_DIR} diff --git a/blocks/blocks/settings.py b/blocks/blocks/settings.py index 8f9d6a87..40dc5a11 100644 --- a/blocks/blocks/settings.py +++ b/blocks/blocks/settings.py @@ -141,6 +141,7 @@ EMAIL_PORT = int(os.environ.get('EMAIL_PORT', '587')) EMAIL_HOST_USER = os.environ.get('EMAIL_HOST_USER', '') EMAIL_HOST_PASSWORD = os.environ.get('EMAIL_HOST_PASSWORD', '') EMAIL_USE_TLS = os.environ.get('EMAIL_USE_TLS', 'true').lower() == 'true' +DEFAULT_FROM_EMAIL = os.environ.get('FROM_EMAIL', 'webmaster@localhost') if EMAIL_HOST: EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' diff --git a/blocks/eda-frontend/.babelrc.json b/blocks/eda-frontend/.babelrc.json deleted file mode 100644 index 7dd5e9df..00000000 --- a/blocks/eda-frontend/.babelrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "presets": ["@babel/preset-react"] -} diff --git a/blocks/eda-frontend/src/redux/authSlice.js b/blocks/eda-frontend/src/redux/authSlice.js index ee5705c1..bb8e9644 100644 --- a/blocks/eda-frontend/src/redux/authSlice.js +++ b/blocks/eda-frontend/src/redux/authSlice.js @@ -32,7 +32,7 @@ export const loadUser = createAsyncThunk( try { const res = await api.get('auth/users/me/', config) - if (res.status === 200) { + if ([200, 201, 204].includes(res.status)) { return res.data } return rejectWithValue(res.data || 'Failed to load user') @@ -69,7 +69,7 @@ export const login = createAsyncThunk( email, password }) - if (res.status === 200) { + if ([200, 201, 204].includes(res.status)) { localStorage.setItem(tokenKey, res.data.auth_token) if (toUrl === '') { dispatch(loadUser()) @@ -117,7 +117,7 @@ export const signUp = createAsyncThunk( password, re_password: reenterPassword }) - if (res.status === 200) { + if ([200, 201, 204].includes(res.status)) { return 'Successfully Signed Up! A verification link has been sent to your email account.' } @@ -165,7 +165,7 @@ export const googleLogin = createAsyncThunk( async (host, { rejectWithValue }) => { try { const res = await api.get(`auth/o/google-oauth2/?redirect_uri=${host}/api/auth/google-callback`) - if (res.status === 200) { + if ([200, 201, 204].includes(res.status)) { // Open google login page window.open(res.data.authorization_url, '_self') return res.data.authorization_url @@ -185,7 +185,7 @@ export const githubLogin = createAsyncThunk( async (host, { rejectWithValue }) => { try { const res = await api.get(`auth/o/github/?redirect_uri=${host}/api/auth/github-callback`) - if (res.status === 200) { + if ([200, 201, 204].includes(res.status)) { // Open GitHub login page window.open(res.data.authorization_url, '_self') return res.data.authorization_url diff --git a/blocks/init.sh b/blocks/init.sh index ef98711c..16215a00 100755 --- a/blocks/init.sh +++ b/blocks/init.sh @@ -7,8 +7,8 @@ PASSWORD='' rm -f xcosblocks.sqlite3 -./manage.py migrate -v0 -./manage.py loaddata xcosblocks +python manage.py migrate -v0 +python manage.py loaddata -v0 saveAPI xcosblocks echo "from authAPI.models import User; User.objects.create_superuser('$EMAIL', '$EMAIL', '$PASSWORD')" | - ./manage.py shell + python manage.py shell |