diff --git a/db.sqlite3 b/db.sqlite3
index 346a3fb..f40bc79 100644
Binary files a/db.sqlite3 and b/db.sqlite3 differ
diff --git a/drf_vue_blog/settings.py b/drf_vue_blog/settings.py
index d26b596..801c357 100644
--- a/drf_vue_blog/settings.py
+++ b/drf_vue_blog/settings.py
@@ -125,9 +125,9 @@ REST_FRAMEWORK = {
'PAGE_SIZE': 5,
# 使用django-filter后端过滤引擎
'DEFAULT_FILTER_BACKENDS': ['django_filters.rest_framework.DjangoFilterBackend'],
- # 'DEFAULT_AUTHENTICATION_CLASSES': (
- # 'rest_framework_simplejwt.authentication.JWTAuthentication',
- # ),
+ 'DEFAULT_AUTHENTICATION_CLASSES': (
+ 'rest_framework_simplejwt.authentication.JWTAuthentication',
+ ),
}
# 媒体文件
@@ -136,12 +136,12 @@ MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
-#
+# simple_jwt配置
-# SIMPLE_JWT = {
-# 'ACCESS_TOKEN_LIFETIME': timedelta(days=1), # 令牌有效时间为1天
-# 'REFRESH_TOKEN_LIFETIME': timedelta(days=10), # 令牌每10天刷新一次
-# }
+SIMPLE_JWT = {
+ 'ACCESS_TOKEN_LIFETIME': timedelta(minutes=1), # 令牌有效时间为1分钟,便于测试
+ 'REFRESH_TOKEN_LIFETIME': timedelta(days=10), # 令牌每10天刷新一次
+}
#将允许将cookie包含在跨站点HTTP请求中
diff --git a/frontend/src/components/ArticleList.vue b/frontend/src/components/ArticleList.vue
index 44da490..1d21296 100644
--- a/frontend/src/components/ArticleList.vue
+++ b/frontend/src/components/ArticleList.vue
@@ -182,7 +182,7 @@ export default {
#paginator {
text-align: center;
- padding-top: 2rem;
+ padding-bottom: 3rem;
}
#paginator a {
diff --git a/frontend/src/components/BlogHeader.vue b/frontend/src/components/BlogHeader.vue
index 557522c..c769c7b 100644
--- a/frontend/src/components/BlogHeader.vue
+++ b/frontend/src/components/BlogHeader.vue
@@ -5,39 +5,98 @@
My Drf-Vue Blog
-
+
+
+
+
欢迎, {{ username }}
+
+ 登录
+
+
@@ -77,12 +136,12 @@ input {
height: 30px;
padding-left: 13px;
padding-right: 46px;
- overflow:hidden;
- text-overflow:ellipsis;
+ overflow: hidden;
+ text-overflow: ellipsis;
}
button {
- border: none;
+ border: none;
height: 30px;
width: 30px;
cursor: pointer;
@@ -110,4 +169,22 @@ button {
font-size: 13px;
color: white;
}
+
+.login-link {
+ color: black;
+}
+
+.login {
+ text-align: left;
+ padding-left: 0.5rem;
+}
+
+.register-link {
+ color: black;
+}
+
+.register {
+ text-align: right;
+ padding-right: 0.5rem;
+}
diff --git a/frontend/src/router/index.js b/frontend/src/router/index.js
index 0572916..3e6a413 100644
--- a/frontend/src/router/index.js
+++ b/frontend/src/router/index.js
@@ -1,6 +1,8 @@
import { createRouter, createWebHistory } from 'vue-router'
import HomePage from '@/views/HomePageView.vue'
import ArticleDetail from '@/views/ArticleDetailView.vue'
+import LoginView from '@/views/LoginView.vue'
+import RegisterView from '@/views/RegisterView.vue'
const routes = [
{
@@ -13,6 +15,16 @@ const routes = [
name: 'detail',
component: ArticleDetail,
},
+ {
+ path: '/login/',
+ name: 'login',
+ component: LoginView,
+ },
+ {
+ path: '/register/',
+ name: 'register',
+ component: RegisterView,
+ }
]
const router = createRouter({
diff --git a/frontend/src/views/LoginView.vue b/frontend/src/views/LoginView.vue
new file mode 100644
index 0000000..b6b501f
--- /dev/null
+++ b/frontend/src/views/LoginView.vue
@@ -0,0 +1,121 @@
+
+
+
+
+
+
+
+
+
diff --git a/frontend/src/views/RegisterView.vue b/frontend/src/views/RegisterView.vue
new file mode 100644
index 0000000..86706e3
--- /dev/null
+++ b/frontend/src/views/RegisterView.vue
@@ -0,0 +1,138 @@
+
+
+
+
+
+
+
+
+
diff --git a/user_info/views.py b/user_info/views.py
index c0338cb..6a993a9 100644
--- a/user_info/views.py
+++ b/user_info/views.py
@@ -41,4 +41,4 @@ class UserViewSet(viewsets.ModelViewSet):
else:
self.permission_classes = [IsAuthenticatedOrReadOnly, IsSelfOrReadOnly]
- return super(UserViewSet, self).get_permissions()
+ return super(UserViewSet, self).get_permissions()