mirror of
https://github.com/eduardogsilva/wireguard_webadmin.git
synced 2025-03-18 18:14:02 +00:00
VPN Invite feature implemented
This commit is contained in:
parent
2c15294d7d
commit
31b9988b98
@ -11,7 +11,9 @@ wireguard_webadmin is a full-featured yet easy-to-configure web interface for ma
|
||||
- **Multi-User Support**: Manage access with different permission levels for each user.
|
||||
- **Multiple WireGuard Instances**: Enables separate management for peers across multiple instances.
|
||||
- **Crypto Key Routing**: Simplifies the configuration for site-to-site interconnections.
|
||||
- **Seamless VPN Invite Sharing**: Instantly generate and distribute secure, time-sensitive VPN invites via email or WhatsApp, complete with QR code and configuration file options.
|
||||
|
||||
|
||||
This project aims to offer an intuitive and user-friendly solution for WireGuard VPN management without compromising the power and flexibility WireGuard provides.
|
||||
|
||||
## License
|
||||
|
12
api/views.py
12
api/views.py
@ -291,17 +291,17 @@ def api_peer_invite(request):
|
||||
PeerInvite.objects.filter(invite_expiration__lt=timezone.now()).delete()
|
||||
user_acl = get_object_or_404(UserAcl, user=request.user)
|
||||
invite_settings = InviteSettings.objects.filter(name='default_settings').first()
|
||||
peer_invite = PeerInvite.objects.none()
|
||||
|
||||
if not invite_settings:
|
||||
data = {'status': 'error', 'message': 'VPN Invite not configured'}
|
||||
return JsonResponse(data, status=400)
|
||||
|
||||
data = {
|
||||
'status': '', 'message': '', 'invite_data': {},
|
||||
'whatsapp_enabled': invite_settings.invite_whatsapp_enabled,
|
||||
'email_enabled': invite_settings.invite_email_enabled,
|
||||
}
|
||||
peer_invite = PeerInvite.objects.none()
|
||||
|
||||
if not invite_settings:
|
||||
data['status'] = 'error'
|
||||
data['message'] = 'Default settings not found'
|
||||
return JsonResponse(data, status=400)
|
||||
|
||||
if user_acl.user_level < invite_settings.required_user_level:
|
||||
data['status'] = 'error'
|
||||
|
@ -20,6 +20,11 @@
|
||||
margin-bottom: 10px;
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
|
||||
#inviteText {
|
||||
white-space: pre-line;
|
||||
text-align: left;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
|
@ -0,0 +1,33 @@
|
||||
# Generated by Django 5.1.5 on 2025-03-01 20:01
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('vpn_invite', '0006_alter_invitesettings_invite_email_body_and_more'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='invitesettings',
|
||||
name='download_5_label',
|
||||
field=models.CharField(blank=True, default='Linux', max_length=32, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='invitesettings',
|
||||
name='invite_email_body',
|
||||
field=models.TextField(default="\nHello,\n\nYou're invited to join our secure WireGuard VPN network. Please click the link below to access your personalized VPN configuration:\n\n{invite_url}\n\nNote: This invitation link will expire in {expire_minutes} minutes. If you need a new link after expiration, please request another invite.\n"),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='invitesettings',
|
||||
name='invite_text_body',
|
||||
field=models.TextField(default="\nHello,\n\nYou're invited to join our secure WireGuard VPN network. Please click the link below to access your personalized VPN configuration:\n\n{invite_url}\n\nNote: This invitation link will expire in {expire_minutes} minutes. If you need a new link after expiration, please request another invite.\n"),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='invitesettings',
|
||||
name='invite_whatsapp_body',
|
||||
field=models.TextField(default="\nHello,\n\nYou're invited to join our secure WireGuard VPN network. Please click the link below to access your personalized VPN configuration:\n\n{invite_url}\n\nNote: This invitation link will expire in {expire_minutes} minutes. If you need a new link after expiration, please request another invite.\n"),
|
||||
),
|
||||
]
|
@ -39,7 +39,7 @@ class InviteSettings(models.Model):
|
||||
download_2_label = models.CharField(max_length=32, default='Android', blank=True, null=True)
|
||||
download_3_label = models.CharField(max_length=32, default='Windows', blank=True, null=True)
|
||||
download_4_label = models.CharField(max_length=32, default='macOS', blank=True, null=True)
|
||||
download_5_label = models.CharField(max_length=32, default='Desktop', blank=True, null=True)
|
||||
download_5_label = models.CharField(max_length=32, default='Linux', blank=True, null=True)
|
||||
download_1_icon = models.CharField(max_length=32, default='fab fa-app-store-ios', blank=True, null=True)
|
||||
download_2_icon = models.CharField(max_length=32, default='fab fa-google-play', blank=True, null=True)
|
||||
download_3_icon = models.CharField(max_length=32, default='fab fa-windows', blank=True, null=True)
|
||||
|
@ -186,7 +186,7 @@ def send_email(destination, subject, body):
|
||||
|
||||
email_settings = EmailSettings.objects.filter(name='email_settings', enabled=True).first()
|
||||
if not email_settings:
|
||||
message = 'Email settings not configured.'
|
||||
message = 'Email not configured.'
|
||||
return success, message
|
||||
|
||||
try:
|
||||
|
@ -135,6 +135,6 @@ STATICFILES_DIRS = [
|
||||
DNS_CONFIG_FILE = '/etc/dnsmasq/wireguard_webadmin_dns.conf'
|
||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||
|
||||
WIREGUARD_WEBADMIN_VERSION = 9956
|
||||
WIREGUARD_WEBADMIN_VERSION = 9958
|
||||
|
||||
from wireguard_webadmin.production_settings import *
|
||||
|
Loading…
Reference in New Issue
Block a user