summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSunil Shetye2025-07-09 17:35:39 +0530
committerSunil Shetye2025-07-09 17:35:39 +0530
commit0977472a768366004fb0dec595c22964c22f6889 (patch)
treea7dfbc79b8821a2ded0759b26c7cb881ce60bc56
parent0bada12e5611a50391f1f0ab715e5eac89eab3c4 (diff)
downloadCommon-Interface-Project-0977472a768366004fb0dec595c22964c22f6889.tar.gz
Common-Interface-Project-0977472a768366004fb0dec595c22964c22f6889.tar.bz2
Common-Interface-Project-0977472a768366004fb0dec595c22964c22f6889.zip
add 201 and 204 to success codes
-rw-r--r--blocks/blocks/settings.py1
-rw-r--r--blocks/eda-frontend/src/redux/authSlice.js10
-rwxr-xr-xblocks/init.sh6
3 files changed, 9 insertions, 8 deletions
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/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