You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
# 导入Django的URL路径配置模块
from django . urls import path
# 导入当前应用( oauth) 的视图模块
from . import views
# 定义应用命名空间,用于模板或反向解析时指定应用(如:{% url 'oauth:oauthlogin' %})
app_name = " oauth "
# URL路由配置列表: 映射URL路径到对应的视图函数/类
urlpatterns = [
# 1. OAuth授权回调接口: 接收第三方平台返回的授权码( code) , 处理后续登录逻辑
path (
r ' oauth/authorize ' ,
views . authorize ) , # 对应视图函数: authorize
# 2. 补充邮箱页面:第三方登录时用户未提供邮箱,跳转至此页面补充
path (
r ' oauth/requireemail/<int:oauthid>.html ' , # 路径参数: oauthid( OAuthUser的ID)
views . RequireEmailView . as_view ( ) , # 对应基于类的视图: RequireEmailView
name = ' require_email ' ) , # 路由名称:用于反向解析
# 3. 邮箱确认接口: 验证用户补充邮箱的有效性( 通过sign签名验证)
path (
r ' oauth/emailconfirm/<int:id>/<sign>.html ' , # 路径参数: id( OAuthUser的ID) 、sign( 验证签名)
views . emailconfirm , # 对应视图函数: emailconfirm
name = ' email_confirm ' ) , # 路由名称:用于反向解析
# 4. 绑定成功页面:邮箱补充或账号绑定完成后,展示成功提示
path (
r ' oauth/bindsuccess/<int:oauthid>.html ' , # 路径参数: oauthid( OAuthUser的ID)
views . bindsuccess , # 对应视图函数: bindsuccess
name = ' bindsuccess ' ) , # 路由名称:用于反向解析
# 5. OAuth登录入口: 生成第三方平台的授权链接, 跳转至第三方授权页面
path (
r ' oauth/oauthlogin ' ,
views . oauthlogin , # 对应视图函数: oauthlogin
name = ' oauthlogin ' ) # 路由名称:用于反向解析
]