from models import EmailTemplate, User, db def create_default_templates(): """Create default email templates if they don't exist.""" # Get the first admin user to be the creator admin = User.query.filter_by(is_admin=True).first() if not admin: print("No admin user found. Please create an admin user first.") return # Define default templates for each notification type default_templates = [ { 'name': 'Account Created', 'subject': 'Welcome to DocuPulse!', 'body': '''
Dear {{ user.username }},
Your account has been successfully created by {{ created_by }}. To get started, you need to set up your password.
Click the link below to set up your password (this link will expire in 24 hours):
If you didn't receive this email or if the link has expired, please contact your administrator to request a new password setup link.
If you have any questions, please don't hesitate to contact our support team.
Best regards,
The DocuPulse Team
Dear {{ user.username }},
We received a request to reset your password for your DocuPulse account. Click the link below to set a new password:
This link will expire in 1 hour.
If you didn't request this password reset, please ignore this email. Your password will remain unchanged.
If you have any concerns about your account security, please contact your administrator immediately.
Best regards,
The DocuPulse Team
Dear {{ user.username }},
Your DocuPulse account has been successfully deleted as requested.
We're sorry to see you go. If you change your mind, you can create a new account at any time.
Best regards,
The DocuPulse Team
Dear {{ user.username }},
Your DocuPulse account has been successfully updated.
If you didn't make these changes, please contact our support team immediately.
Best regards,
The DocuPulse Team
Dear {{ user.username }},
{{ sender.username }} has invited you to join the room "{{ room_name }}".
Click the link below to view the room:
Best regards,
The DocuPulse Team
Dear {{ user.username }},
Your invitation to the room "{{ room_name }}" has been removed.
If you believe this is an error, please contact the room administrator.
Best regards,
The DocuPulse Team
Dear {{ user.username }},
{{ sender.username }} has invited you to join a conversation.
Click the link below to view the conversation:
Best regards,
The DocuPulse Team
Dear {{ user.username }},
Your invitation to the conversation has been removed.
If you believe this is an error, please contact the conversation administrator.
Best regards,
The DocuPulse Team
Dear {{ user.username }},
{{ sender.username }} has sent a new message in your conversation.
Click the link below to view the message:
Best regards,
The DocuPulse Team