diff --git a/backend/authentications/urls.py b/backend/authentications/urls.py
index 75c5914..6029eea 100644
--- a/backend/authentications/urls.py
+++ b/backend/authentications/urls.py
@@ -1,13 +1,11 @@
from django.urls import path
from rest_framework_simplejwt import views as jwt_views
-from authentications.views import ObtainTokenPairWithCustomView, GreetingView, GoogleLogin, GoogleRetrieveUserInfo, CheckAccessTokenAndRefreshToken
+from authentications.views import ObtainTokenPairWithCustomView, GoogleRetrieveUserInfo, CheckAccessTokenAndRefreshToken
urlpatterns = [
path('token/obtain/', jwt_views.TokenObtainPairView.as_view(), name='token_create'),
path('token/refresh/', jwt_views.TokenRefreshView.as_view(), name='token_refresh'),
path('token/custom_obtain/', ObtainTokenPairWithCustomView.as_view(), name='token_create_custom'),
- path('hello/', GreetingView.as_view(), name='hello_world'),
- path('dj-rest-auth/google/', GoogleLogin.as_view(), name="google_login"),
path('auth/google/', GoogleRetrieveUserInfo.as_view()),
path('auth/status/', CheckAccessTokenAndRefreshToken.as_view(), name='check_token_status')
]
\ No newline at end of file
diff --git a/backend/authentications/views.py b/backend/authentications/views.py
index 167581b..87f662e 100644
--- a/backend/authentications/views.py
+++ b/backend/authentications/views.py
@@ -7,17 +7,12 @@ from django.conf import settings
from django.contrib.auth.hashers import make_password
from rest_framework import status
-from rest_framework.permissions import IsAuthenticated, AllowAny
+from rest_framework.permissions import AllowAny
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework_simplejwt.tokens import RefreshToken
from rest_framework_simplejwt.authentication import JWTAuthentication
-
-from allauth.socialaccount.providers.google.views import GoogleOAuth2Adapter
-
-from dj_rest_auth.registration.views import SocialLoginView
-
from google_auth_oauthlib.flow import InstalledAppFlow
from authentications.access_token_cache import store_token
@@ -69,39 +64,6 @@ class ObtainTokenPairWithCustomView(APIView):
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
-class GreetingView(APIView):
- """
- Hello World View.
- Returns a greeting and user information for authenticated users.
- """
- permission_classes = (IsAuthenticated,)
-
- def get(self, request):
- """
- Retrieve a greeting message and user information.
- """
- user = request.user
- user_info = {
- "username": user.username,
- }
- response_data = {
- "message": "Hello, world!",
- "user_info": user_info,
- }
- return Response(response_data, status=status.HTTP_200_OK)
-
-
-class GoogleLogin(SocialLoginView):
- """
- Google Login View.
- Handles Google OAuth2 authentication.
- """
- # permission_classes = (AllowAny,)
- adapter_class = GoogleOAuth2Adapter
- # client_class = OAuth2Client
- # callback_url = 'http://localhost:8000/accounts/google/login/callback/'
-
-
class GoogleRetrieveUserInfo(APIView):
"""
Retrieve user information from Google and create a user if not exists.
diff --git a/backend/users/migrations/0005_alter_userstats_endurance_and_more.py b/backend/users/migrations/0005_alter_userstats_endurance_and_more.py
index 35fe6f7..76ec5c3 100644
--- a/backend/users/migrations/0005_alter_userstats_endurance_and_more.py
+++ b/backend/users/migrations/0005_alter_userstats_endurance_and_more.py
@@ -25,7 +25,7 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='userstats',
name='luck',
- field=models.IntegerField(default=users.models.random_luck, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(50)]),
+ field=models.IntegerField(default=1, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(50)]),
),
migrations.AlterField(
model_name='userstats',
diff --git a/backend/users/models.py b/backend/users/models.py
index 7a765a6..2fe1df6 100644
--- a/backend/users/models.py
+++ b/backend/users/models.py
@@ -31,14 +31,12 @@ class CustomUser(AbstractBaseUser, PermissionsMixin):
# Fields for authentication
USERNAME_FIELD = 'email'
- REQUIRED_FIELDS = ['username', 'first_name']
+ REQUIRED_FIELDS = []
def __str__(self):
# String representation of the user
return self.username
-
-def random_luck():
- return random.randint(1, 50)
+
class UserStats(models.Model):
"""
diff --git a/backend/users/views.py b/backend/users/views.py
index af201b7..9d022e3 100644
--- a/backend/users/views.py
+++ b/backend/users/views.py
@@ -7,6 +7,8 @@ from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework.parsers import MultiPartParser
+from rest_framework_simplejwt.tokens import RefreshToken
+
from users.serializers import CustomUserSerializer, UpdateProfileSerializer
from users.models import CustomUser
@@ -25,7 +27,9 @@ class CustomUserCreate(APIView):
if serializer.is_valid():
user = serializer.save()
if user:
- return Response(serializer.data, status=status.HTTP_201_CREATED)
+ refresh = RefreshToken.for_user(user)
+ return Response(data={'access_token': str(refresh.access_token), 'refresh_token': str(refresh),},
+ status=status.HTTP_201_CREATED)
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
diff --git a/frontend/.eslintrc.cjs b/frontend/.eslintrc.cjs
index 1a8aa39..809eec3 100644
--- a/frontend/.eslintrc.cjs
+++ b/frontend/.eslintrc.cjs
@@ -13,5 +13,6 @@ module.exports = {
plugins: ["react-refresh"],
rules: {
"react-refresh/only-export-components": ["warn", { allowConstantExport: true }],
+ "react/prop-types": 0,
},
};
diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx
index 1ab242f..a917ca5 100644
--- a/frontend/src/App.jsx
+++ b/frontend/src/App.jsx
@@ -1,21 +1,19 @@
-import { useEffect } from "react";
import "./App.css";
-import { Route, Routes, Navigate } from "react-router-dom";
import axios from "axios";
-import TestAuth from "./components/testAuth";
-import LoginPage from "./components/authentication/LoginPage";
-import SignUpPage from "./components/authentication/SignUpPage";
-import NavBar from "./components/navigations/Navbar";
-import Calendar from "./components/calendar/calendar";
-import KanbanPage from "./components/kanbanBoard/kanbanPage";
-import IconSideNav from "./components/navigations/IconSideNav";
-import Eisenhower from "./components/EisenhowerMatrix/Eisenhower";
-import PrivateRoute from "./PrivateRoute";
-import ProfileUpdatePage from "./components/profilePage";
-import Dashboard from "./components/dashboard/dashboard";
+import { useEffect } from "react";
+import { Route, Routes, Navigate } from "react-router-dom";
+import { LoginPage } from "./components/authentication/LoginPage";
+import { SignUp } from "./components/authentication/SignUpPage";
+import { NavBar } from "./components/navigations/Navbar";
+import { Calendar } from "./components/calendar/calendar";
+import { KanbanPage } from "./components/kanbanBoard/kanbanPage";
+import { SideNav } from "./components/navigations/IconSideNav";
+import { Eisenhower } from "./components/EisenhowerMatrix/Eisenhower";
+import { PrivateRoute } from "./PrivateRoute";
+import { ProfileUpdatePage } from "./components/profile/profilePage";
+import { Dashboard } from "./components/dashboard/dashboard";
import { LandingPage } from "./components/landingPage/LandingPage";
-import PublicRoute from "./PublicRoute";
-
+import { PublicRoute } from "./PublicRoute";
import { useAuth } from "./hooks/AuthHooks";
const baseURL = import.meta.env.VITE_BASE_URL;
@@ -48,9 +46,7 @@ const App = () => {
setIsAuthenticated(false);
}
})
- .catch((error) => {
- console.error("Error checking login status:", error.message);
- });
+ .catch((error) => {});
};
checkLoginStatus();
@@ -70,7 +66,7 @@ const NonAuthenticatedComponents = () => {
{title}
@@ -45,13 +46,13 @@ function TaskDetailModal({ title, description, tags, difficulty, challenge, impo