Files
2026-04-23 10:43:49 +00:00

19 lines
655 B
Plaintext

# sunderer_app/sunderer_app/custom_user.py
import frappe
from frappe.core.doctype.user.user import User as CoreUser
class CustomUser(CoreUser):
def get_redirect_url(self):
"""自定义用户创建后的重定向URL"""
# 检查是否是新用户注册
if self.flags.in_insert and self.new_password:
# 新用户设置密码后,跳转到自定义页面
return "/custom-update-password"
# 默认行为
return super().get_redirect_url()
def after_user_creation(doc, method):
"""用户创建后触发的钩子"""
# 这里可以添加额外的用户初始化逻辑
pass