\x89PNG\r\n\x1a\n\x00\x00\x00\x0DIHDR\x00\x00\x00\x01\x00 \x00\x00\x01\x08\x06\x00\x00\x00\x1F\x15\xC4\x89\x00\x00\x00 \x0AIDATx\x9Ccb\x00\x00\x00\x06\x00\x03\x1A\x05\x9D\x00\x00 \x00\x00IEND\xAE\x42\x60\x82
| Path : /var/www/html/yedekledb24/DatabaseBackupMasterv3/DatabaseBackupMaster/ |
|
B-Con CMD Config cPanel C-Rdp D-Log Info Jump Mass Ransom Symlink vHost Zone-H |
| Current File : /var/www/html/yedekledb24/DatabaseBackupMasterv3/DatabaseBackupMaster/forms.py |
from flask_wtf import FlaskForm
from wtforms import StringField, IntegerField, SelectField, PasswordField, BooleanField, RadioField, EmailField, SubmitField
from wtforms.validators import DataRequired, NumberRange, Optional, Length, Email, ValidationError, EqualTo
from models import User
class DatabaseConnectionForm(FlaskForm):
"""Form for database connection configuration."""
name = StringField('Bağlantı Adı', validators=[DataRequired(), Length(max=64)])
db_type = SelectField('Veritabanı Tipi', choices=[
('mysql', 'MySQL'),
('mariadb', 'MariaDB'),
('postgresql', 'PostgreSQL')
], validators=[DataRequired()])
host = StringField('Sunucu', validators=[DataRequired(), Length(max=128)])
port = IntegerField('Port', validators=[DataRequired(), NumberRange(min=1, max=65535)])
username = StringField('Kullanıcı Adı', validators=[DataRequired(), Length(max=64)])
password = PasswordField('Şifre', validators=[DataRequired(), Length(max=128)])
database = StringField('Veritabanı Adı', validators=[DataRequired(), Length(max=64)])
pg_version = SelectField('PostgreSQL Sürümü', choices=[
('', 'Otomatik Algıla'),
('13', 'PostgreSQL 13'),
('14', 'PostgreSQL 14'),
('15', 'PostgreSQL 15'),
('16', 'PostgreSQL 16'),
('17', 'PostgreSQL 17')
], validators=[Optional()])
class StorageTargetForm(FlaskForm):
"""Form for storage target configuration."""
name = StringField('Depolama Adı', validators=[DataRequired(), Length(max=64)])
storage_type = SelectField('Depolama Tipi', choices=[
('smb', 'SMB/CIFS (Windows Paylaşımı)'),
('nfs', 'NFS'),
('ftp', 'FTP'),
('sftp', 'SFTP (SSH File Transfer)')
], validators=[DataRequired()])
host = StringField('Sunucu', validators=[DataRequired(), Length(max=128)])
port = IntegerField('Port', validators=[Optional(), NumberRange(min=1, max=65535)])
username = StringField('Kullanıcı Adı', validators=[Optional(), Length(max=64)])
password = PasswordField('Şifre', validators=[Optional(), Length(max=128)])
path = StringField('Yol/Paylaşım', validators=[DataRequired(), Length(max=256)])
class BackupJobForm(FlaskForm):
"""Form for backup job configuration."""
name = StringField('Görev Adı', validators=[DataRequired(), Length(max=64)])
database_id = SelectField('Veritabanı Bağlantısı', coerce=int, validators=[DataRequired()])
storage_id = SelectField('Depolama Hedefi', coerce=int, validators=[DataRequired()])
schedule_type = SelectField('Zamanlama Türü', choices=[
('daily', 'Günlük'),
('weekly', 'Haftalık'),
('monthly', 'Aylık'),
('custom', 'Özel Cron İfadesi')
], validators=[DataRequired()])
schedule_value = StringField('Zamanlama Değeri', validators=[DataRequired()])
retention_days = IntegerField('Saklama Süresi (Gün)', validators=[DataRequired(), NumberRange(min=1)])
enabled = BooleanField('Etkinleştirildi', default=True)
class LoginForm(FlaskForm):
"""Form for user login."""
username = StringField('Kullanıcı Adı', validators=[DataRequired()])
password = PasswordField('Şifre', validators=[DataRequired()])
remember_me = BooleanField('Beni Hatırla')
submit = SubmitField('Giriş Yap')
class RegistrationForm(FlaskForm):
"""Form for user registration."""
username = StringField('Kullanıcı Adı', validators=[DataRequired(), Length(min=3, max=64)])
email = EmailField('Email', validators=[DataRequired(), Email(), Length(max=120)])
password = PasswordField('Şifre', validators=[DataRequired(), Length(min=8)])
password2 = PasswordField('Şifreyi Tekrarla', validators=[DataRequired(), EqualTo('password', message='Şifreler eşleşmiyor.')])
is_admin = BooleanField('Admin Yetkisi', default=False)
submit = SubmitField('Kayıt Ol')
def validate_username(self, username):
"""Validate that username doesn't already exist."""
user = User.query.filter_by(username=username.data).first()
if user is not None:
raise ValidationError('Bu kullanıcı adı zaten kullanılıyor. Lütfen farklı bir tane seçin.')
def validate_email(self, email):
"""Validate that email doesn't already exist."""
user = User.query.filter_by(email=email.data).first()
if user is not None:
raise ValidationError('Bu email adresi zaten kullanılıyor. Lütfen farklı bir tane girin.')
class SmtpSettingsForm(FlaskForm):
"""Form for configuring SMTP email settings."""
mail_server = StringField('SMTP Server', validators=[DataRequired(), Length(max=128)])
mail_username = StringField('SMTP Username', validators=[DataRequired(), Length(max=128)])
mail_password = PasswordField('SMTP Password', validators=[DataRequired(), Length(max=128)])
mail_default_sender = EmailField('Sender Email', validators=[DataRequired(), Email(), Length(max=128)])
mail_connection_type = RadioField('Connection Type', choices=[
('tls', 'TLS (Port 587)'),
('ssl', 'SSL (Port 465)')
], default='tls', validators=[DataRequired()])
notification_emails = StringField('Notification Recipients',
validators=[DataRequired(), Length(max=256)],
description="Comma-separated list of email addresses to receive backup notifications")