Browse Source

Merge remote-tracking branch 'old/unstable' into unstable

TonyKurts 3 months ago
parent
commit
afa784bbcb

+ 2 - 2
bin/install.cfg

@@ -2,6 +2,6 @@ TICKETS="https://git.sharix-app.org/ShariX_Open/sharix-open-tickets.git"
 BACKEND="https://git.sharix-app.org/ShariX_Open/sharix-open-backend.git"
 CONFIG="https://git.sharix-app.org/ShariX_Open/sharix-open-config.git"
 DESIGN_TEMPLATE="https://git.sharix-app.org/ShariX_Open/sharix-open-webapp-design-template.git"
-WEBSERVICE_RUNNING="https://git.sharix-app.org/ShariX_Open/sharix-open-webservice-running.git"
-LANDING="https://git.sharix-app.org/ShariX_Open/sharix-open-landing.git"
+WEBSERVICE_RUNNING="https://git.sharix-app.org/ShariX_Assist/sharix-assist-webservice-running.git"
+LANDING="https://git.sharix-app.org/ShariX_Assist/sharix-assist-landing.git"
 USER_MODEL="https://git.sharix-app.org/ShariX_Open/sharix-open-user-model.git"

+ 3 - 3
bin/install.sh

@@ -39,8 +39,8 @@ update_repository "$TICKETS" "tickets" "master"
 update_repository "$BACKEND" "dbsynce" "metasynced_module"
 update_repository "$CONFIG" "conf" "master"
 update_repository "$DESIGN_TEMPLATE" "design_template" "unstable"
-update_repository "$WEBSERVICE_RUNNING" "webservice_running" "unstable"
-update_repository "$LANDING" "landing" "landing_module"
+update_repository "$WEBSERVICE_RUNNING" "webservice_running" "assist"
+update_repository "$LANDING" "landing" "new-version"
 update_repository "$USER_MODEL" "user" "master"
 update_repository "$WEBAPP_BASE" "design_template" "unstable"
 git pull
@@ -62,7 +62,7 @@ else
 fi
 
 # Run Django migrations and other commands
-python manage.py makemigrations dbsynce tickets webservice_running landing user
+python manage.py makemigrations dbsynce tickets webservice_running user
 python manage.py migrate
 python manage.py collectstatic -l --no-input
 

+ 0 - 1
core/settings.py

@@ -53,7 +53,6 @@ INSTALLED_APPS = [
     'django_spaghetti',
     'debug_toolbar',
     'ckeditor',
-    'landing.apps.LandingConfig',
     'fontawesomefree',
 ]
 

+ 1 - 1
core/urls.py

@@ -14,7 +14,7 @@ urlpatterns = [
         path('design/', include("design_template.urls"), name='design'),
         path('dbsynce/', include("dbsynce.urls"), name="dbsynce"),
         path('webservice/', include("webservice_running.urls"), name='webservice_running'),
-        path('landing/', include("landing.urls"), name="landing"),
+        #path('landing/', include("landing.urls"), name="landing"),
         prefix_default_language=False,
     )
     

+ 10 - 6
sharix_admin/signals.py

@@ -6,6 +6,7 @@ from django.db.models.signals import post_migrate
 from django.contrib.auth import get_user_model
 from django.contrib.auth.hashers import make_password
 from django.conf import settings
+from django.db import models
 
 from tickets.models import TicketList
 
@@ -127,9 +128,12 @@ def create_initial_ticket_lists(sender, **kwargs):
 
 
 # Откючаем тестовых пользователей (если такие есть), если DEBUG=False и наоброт
-if Group.objects.filter(name="TEST").exists():
-    test_group = Group.objects.get(name="TEST")
-    users_in_test_group = User.objects.filter(groups=test_group)
-
-    if users_in_test_group:
-        users_in_test_group.update(is_active=settings.DEBUG)
+try:
+    if Group.objects.filter(name="TEST").exists():
+        test_group = Group.objects.get(name="TEST")
+        users_in_test_group = User.objects.filter(groups=test_group)
+
+        if users_in_test_group:
+            users_in_test_group.update(is_active=settings.DEBUG)
+except:
+    print("Test user validation is not available. Models have not been created yet")

+ 1 - 1
sharix_admin/templates/sharix_admin/base_admin.html

@@ -206,7 +206,7 @@
     </div>
 
     <div class="d-flex gap-3 mx-2">
-        <a href="{% url 'contact' %}">{% trans 'Contacts' %}</a>
+        {% comment %} <a href="{% url 'contact' %}">{% trans 'Contacts' %}</a> {% endcomment %}
         <a href="https://wiki.sharix-app.org/doku.php/sharix/legal/soglashenie_s_servisom_na_ispolzovanie_platformy_sharix">{% trans 'Terms of use' %}</a>
         <a href="https://wiki.sharix-app.org/doku.php/sharix/legal/politika_konfidencialnosti_platformy_sharix">{% trans 'Privacy policy' %}</a>
         <a href="https://wiki.sharix-app.org/doku.php">Помощь</a>

+ 1 - 0
sharix_admin/urls.py

@@ -74,6 +74,7 @@ urlpatterns = [
 
     path('api/v1/auth/', include('djoser.urls.authtoken'), name="api-auth"),
     path('api/v1/platform/', include(router.urls), name="api-platform"),
+    path('by_phone/<phone_number>/', get_user_by_phone_number, name='get_user_by_phone_number'),
 
     path('senderphone/', PhoneSender.as_view()),
 

+ 2 - 1
sharix_admin/views/__init__.py

@@ -16,4 +16,5 @@ from .payment import *
 from .balance import *
 from .trans_id import *
 from .schema import *
-from .user_info import *
+from .user_info import *
+from .get_userid import *

+ 29 - 0
sharix_admin/views/get_userid.py

@@ -0,0 +1,29 @@
+from django.http import JsonResponse
+from django.contrib.auth import get_user_model
+from django.contrib.auth.decorators import login_required
+from django.views.decorators.csrf import csrf_exempt
+
+@csrf_exempt
+def get_user_by_phone_number(request, phone_number):
+    if request.method == 'GET':
+        if phone_number:
+            User = get_user_model()
+            try:
+                users_with_phone = User.objects.filter(phone_number=phone_number)
+                if users_with_phone.exists():
+                    user = users_with_phone.first()
+                    user_info = {
+                        'id': user.id,
+                        'username': user.username,
+                        'email': user.email,
+                    }
+                    return JsonResponse(user_info)
+                else:
+                    # Если пользователь не найден, возвращаем ошибку 404
+                    return JsonResponse({'error': 'User not found'}, status=404)
+            except User.DoesNotExist:
+                return JsonResponse({'error': 'User not found'}, status=404)
+        else:
+            return JsonResponse({'error': 'Phone number is missing'}, status=400)
+    else:
+        return JsonResponse({'error': 'Only GET requests are allowed'}, status=405)