micro-users 1.8.3__tar.gz → 1.8.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of micro-users might be problematic. Click here for more details.

Files changed (54) hide show
  1. {micro_users-1.8.3 → micro_users-1.8.6}/PKG-INFO +19 -1
  2. {micro_users-1.8.3 → micro_users-1.8.6}/README.md +19 -1
  3. {micro_users-1.8.3 → micro_users-1.8.6}/micro_users.egg-info/PKG-INFO +19 -1
  4. {micro_users-1.8.3 → micro_users-1.8.6}/micro_users.egg-info/SOURCES.txt +4 -0
  5. {micro_users-1.8.3 → micro_users-1.8.6}/pyproject.toml +1 -1
  6. {micro_users-1.8.3 → micro_users-1.8.6}/setup.py +1 -1
  7. micro_users-1.8.6/users/context_processors.py +9 -0
  8. {micro_users-1.8.3 → micro_users-1.8.6}/users/forms.py +39 -26
  9. micro_users-1.8.6/users/migrations/0004_scopesettings.py +24 -0
  10. {micro_users-1.8.3 → micro_users-1.8.6}/users/models.py +18 -0
  11. micro_users-1.8.6/users/static/users/css/login.css +273 -0
  12. micro_users-1.8.6/users/static/users/js/manage_users.js +189 -0
  13. {micro_users-1.8.3 → micro_users-1.8.6}/users/static/users/js/permissions.js +7 -0
  14. micro_users-1.8.6/users/templates/users/manage_users.html +126 -0
  15. {micro_users-1.8.3 → micro_users-1.8.6}/users/templates/users/partials/scope_actions.html +2 -2
  16. {micro_users-1.8.3 → micro_users-1.8.6}/users/templates/users/partials/scope_form.html +2 -2
  17. {micro_users-1.8.3 → micro_users-1.8.6}/users/templates/users/partials/scope_manager.html +2 -2
  18. {micro_users-1.8.3 → micro_users-1.8.6}/users/templates/users/partials/user_actions.html +2 -1
  19. {micro_users-1.8.3 → micro_users-1.8.6}/users/templates/users/profile/profile.html +4 -4
  20. {micro_users-1.8.3 → micro_users-1.8.6}/users/templates/users/widgets/grouped_permissions.html +1 -1
  21. {micro_users-1.8.3 → micro_users-1.8.6}/users/urls.py +1 -0
  22. micro_users-1.8.6/users/utils.py +14 -0
  23. {micro_users-1.8.3 → micro_users-1.8.6}/users/views.py +43 -4
  24. micro_users-1.8.3/users/static/users/css/login.css +0 -184
  25. micro_users-1.8.3/users/templates/users/manage_users.html +0 -158
  26. {micro_users-1.8.3 → micro_users-1.8.6}/LICENSE +0 -0
  27. {micro_users-1.8.3 → micro_users-1.8.6}/MANIFEST.in +0 -0
  28. {micro_users-1.8.3 → micro_users-1.8.6}/micro_users.egg-info/dependency_links.txt +0 -0
  29. {micro_users-1.8.3 → micro_users-1.8.6}/micro_users.egg-info/requires.txt +0 -0
  30. {micro_users-1.8.3 → micro_users-1.8.6}/micro_users.egg-info/top_level.txt +0 -0
  31. {micro_users-1.8.3 → micro_users-1.8.6}/setup.cfg +0 -0
  32. {micro_users-1.8.3 → micro_users-1.8.6}/users/__init__.py +0 -0
  33. {micro_users-1.8.3 → micro_users-1.8.6}/users/admin.py +0 -0
  34. {micro_users-1.8.3 → micro_users-1.8.6}/users/apps.py +0 -0
  35. {micro_users-1.8.3 → micro_users-1.8.6}/users/filters.py +0 -0
  36. {micro_users-1.8.3 → micro_users-1.8.6}/users/middleware.py +0 -0
  37. {micro_users-1.8.3 → micro_users-1.8.6}/users/migrations/0001_initial.py +0 -0
  38. {micro_users-1.8.3 → micro_users-1.8.6}/users/migrations/0002_alter_useractivitylog_action.py +0 -0
  39. {micro_users-1.8.3 → micro_users-1.8.6}/users/migrations/0003_scope_alter_customuser_options_and_more.py +0 -0
  40. {micro_users-1.8.3 → micro_users-1.8.6}/users/migrations/__init__.py +0 -0
  41. {micro_users-1.8.3 → micro_users-1.8.6}/users/signals.py +0 -0
  42. {micro_users-1.8.3 → micro_users-1.8.6}/users/static/img/default_profile.webp +0 -0
  43. {micro_users-1.8.3 → micro_users-1.8.6}/users/static/img/login_logo.webp +0 -0
  44. {micro_users-1.8.3 → micro_users-1.8.6}/users/static/users/css/detail.css +0 -0
  45. {micro_users-1.8.3 → micro_users-1.8.6}/users/static/users/css/permissions.css +0 -0
  46. {micro_users-1.8.3 → micro_users-1.8.6}/users/static/users/css/profile.css +0 -0
  47. {micro_users-1.8.3 → micro_users-1.8.6}/users/static/users/css/style.css +0 -0
  48. {micro_users-1.8.3 → micro_users-1.8.6}/users/static/users/js/login.js +0 -0
  49. {micro_users-1.8.3 → micro_users-1.8.6}/users/tables.py +0 -0
  50. {micro_users-1.8.3 → micro_users-1.8.6}/users/templates/registration/login.html +0 -0
  51. {micro_users-1.8.3 → micro_users-1.8.6}/users/templates/users/profile/profile_edit.html +0 -0
  52. {micro_users-1.8.3 → micro_users-1.8.6}/users/templates/users/user_activity_log.html +0 -0
  53. {micro_users-1.8.3 → micro_users-1.8.6}/users/templates/users/user_detail.html +0 -0
  54. {micro_users-1.8.3 → micro_users-1.8.6}/users/templates/users/user_form.html +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: micro_users
3
- Version: 1.8.3
3
+ Version: 1.8.6
4
4
  Summary: Arabic Django user management app with abstract user, permissions, and activity logging
5
5
  Home-page: https://github.com/debeski/micro-users
6
6
  Author: DeBeski
@@ -92,6 +92,21 @@ MIDDLEWARE = [
92
92
  ]
93
93
  ```
94
94
 
95
+ 3. Add Context Processor in `settings.py` (Optional, for `scope_enabled` variable in templates):
96
+ ```python
97
+ TEMPLATES = [
98
+ {
99
+ # ...
100
+ 'OPTIONS': {
101
+ 'context_processors': [
102
+ # ...
103
+ 'users.context_processors.scope_settings', # Add this line
104
+ ],
105
+ },
106
+ },
107
+ ]
108
+ ```
109
+
95
110
  3. Set custom user model in `settings.py`:
96
111
  ```python
97
112
  AUTH_USER_MODEL = 'users.CustomUser'
@@ -215,3 +230,6 @@ MICRO_USERS_THEME = {
215
230
  | v1.8.1 | • **UI Refinement**: Swapped `Email` and `Phone` positions across all forms, tables, and detail views<br>• **Field Logic**: Set `Email` and `Phone` as optional (not required) for all users<br>• **Security**: Added `manage_staff` custom permission to restrict `is_staff` management to authorized managers only<br>• **Bug Fix**: Reserved `manage_staff` assignment power strictly for Superusers and fixed UI grouping for custom permissions |
216
231
  | v1.8.2 | • **Login UX**: Enhanced login flow with auto-focus on username and improved "Enter to Submit" handling |
217
232
  | v1.8.3 | • **CSP Compliance**: Added `nonce` attribute support to all inline and external script tags (Login, Permissions, Manage Users) for Content Security Policy compliance |
233
+ | v1.8.4 | • **Strict CSP**: Refactored inline JS event handlers to use Event Listeners, fully resolving CSP violation errors |
234
+ | v1.8.5 | • **Optional Scopes**: Added ability for Superusers to toggle Scope system ON/OFF via User Management interface |
235
+ | v1.8.6 | • **Strict CSP Repair**: Fixed remaining inline event handlers in User Management pages (`manage_users`, `scope_form`) that were violating CSP directives, moving all logic to external `manage_users.js` |
@@ -60,6 +60,21 @@ MIDDLEWARE = [
60
60
  ]
61
61
  ```
62
62
 
63
+ 3. Add Context Processor in `settings.py` (Optional, for `scope_enabled` variable in templates):
64
+ ```python
65
+ TEMPLATES = [
66
+ {
67
+ # ...
68
+ 'OPTIONS': {
69
+ 'context_processors': [
70
+ # ...
71
+ 'users.context_processors.scope_settings', # Add this line
72
+ ],
73
+ },
74
+ },
75
+ ]
76
+ ```
77
+
63
78
  3. Set custom user model in `settings.py`:
64
79
  ```python
65
80
  AUTH_USER_MODEL = 'users.CustomUser'
@@ -182,4 +197,7 @@ MICRO_USERS_THEME = {
182
197
  | v1.8.0 | • **Permissions UI**: Complete redesign with App/Model-based grouping and hierarchical checkboxes<br>• **Aesthetics**: Applied modern glassmorphism theme to permission cards with interactive toggles<br>• **Security**: Implemented 3-level security logic (GM, SM, User) and "invisible" Superuser protection<br>• **Foolproofing**: Added self-editing protection for staff and scope enforcement for managers<br>• **Localization**: Fully translated system auth labels and metadata to Arabic |
183
198
  | v1.8.1 | • **UI Refinement**: Swapped `Email` and `Phone` positions across all forms, tables, and detail views<br>• **Field Logic**: Set `Email` and `Phone` as optional (not required) for all users<br>• **Security**: Added `manage_staff` custom permission to restrict `is_staff` management to authorized managers only<br>• **Bug Fix**: Reserved `manage_staff` assignment power strictly for Superusers and fixed UI grouping for custom permissions |
184
199
  | v1.8.2 | • **Login UX**: Enhanced login flow with auto-focus on username and improved "Enter to Submit" handling |
185
- | v1.8.3 | • **CSP Compliance**: Added `nonce` attribute support to all inline and external script tags (Login, Permissions, Manage Users) for Content Security Policy compliance |
200
+ | v1.8.3 | • **CSP Compliance**: Added `nonce` attribute support to all inline and external script tags (Login, Permissions, Manage Users) for Content Security Policy compliance |
201
+ | v1.8.4 | • **Strict CSP**: Refactored inline JS event handlers to use Event Listeners, fully resolving CSP violation errors |
202
+ | v1.8.5 | • **Optional Scopes**: Added ability for Superusers to toggle Scope system ON/OFF via User Management interface |
203
+ | v1.8.6 | • **Strict CSP Repair**: Fixed remaining inline event handlers in User Management pages (`manage_users`, `scope_form`) that were violating CSP directives, moving all logic to external `manage_users.js` |
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: micro-users
3
- Version: 1.8.3
3
+ Version: 1.8.6
4
4
  Summary: Arabic Django user management app with abstract user, permissions, and activity logging
5
5
  Home-page: https://github.com/debeski/micro-users
6
6
  Author: DeBeski
@@ -92,6 +92,21 @@ MIDDLEWARE = [
92
92
  ]
93
93
  ```
94
94
 
95
+ 3. Add Context Processor in `settings.py` (Optional, for `scope_enabled` variable in templates):
96
+ ```python
97
+ TEMPLATES = [
98
+ {
99
+ # ...
100
+ 'OPTIONS': {
101
+ 'context_processors': [
102
+ # ...
103
+ 'users.context_processors.scope_settings', # Add this line
104
+ ],
105
+ },
106
+ },
107
+ ]
108
+ ```
109
+
95
110
  3. Set custom user model in `settings.py`:
96
111
  ```python
97
112
  AUTH_USER_MODEL = 'users.CustomUser'
@@ -215,3 +230,6 @@ MICRO_USERS_THEME = {
215
230
  | v1.8.1 | • **UI Refinement**: Swapped `Email` and `Phone` positions across all forms, tables, and detail views<br>• **Field Logic**: Set `Email` and `Phone` as optional (not required) for all users<br>• **Security**: Added `manage_staff` custom permission to restrict `is_staff` management to authorized managers only<br>• **Bug Fix**: Reserved `manage_staff` assignment power strictly for Superusers and fixed UI grouping for custom permissions |
216
231
  | v1.8.2 | • **Login UX**: Enhanced login flow with auto-focus on username and improved "Enter to Submit" handling |
217
232
  | v1.8.3 | • **CSP Compliance**: Added `nonce` attribute support to all inline and external script tags (Login, Permissions, Manage Users) for Content Security Policy compliance |
233
+ | v1.8.4 | • **Strict CSP**: Refactored inline JS event handlers to use Event Listeners, fully resolving CSP violation errors |
234
+ | v1.8.5 | • **Optional Scopes**: Added ability for Superusers to toggle Scope system ON/OFF via User Management interface |
235
+ | v1.8.6 | • **Strict CSP Repair**: Fixed remaining inline event handlers in User Management pages (`manage_users`, `scope_form`) that were violating CSP directives, moving all logic to external `manage_users.js` |
@@ -11,6 +11,7 @@ micro_users.egg-info/top_level.txt
11
11
  users/__init__.py
12
12
  users/admin.py
13
13
  users/apps.py
14
+ users/context_processors.py
14
15
  users/filters.py
15
16
  users/forms.py
16
17
  users/middleware.py
@@ -18,10 +19,12 @@ users/models.py
18
19
  users/signals.py
19
20
  users/tables.py
20
21
  users/urls.py
22
+ users/utils.py
21
23
  users/views.py
22
24
  users/migrations/0001_initial.py
23
25
  users/migrations/0002_alter_useractivitylog_action.py
24
26
  users/migrations/0003_scope_alter_customuser_options_and_more.py
27
+ users/migrations/0004_scopesettings.py
25
28
  users/migrations/__init__.py
26
29
  users/static/img/default_profile.webp
27
30
  users/static/img/login_logo.webp
@@ -31,6 +34,7 @@ users/static/users/css/permissions.css
31
34
  users/static/users/css/profile.css
32
35
  users/static/users/css/style.css
33
36
  users/static/users/js/login.js
37
+ users/static/users/js/manage_users.js
34
38
  users/static/users/js/permissions.js
35
39
  users/templates/registration/login.html
36
40
  users/templates/users/manage_users.html
@@ -8,7 +8,7 @@ build-backend = "setuptools.build_meta"
8
8
 
9
9
  [project]
10
10
  name = "micro_users"
11
- version = "1.8.3"
11
+ version = "1.8.6"
12
12
  description = "Arabic Django user management app with abstract user, permissions, and activity logging"
13
13
  readme = "README.md"
14
14
  requires-python = ">=3.11"
@@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
5
5
 
6
6
  setup(
7
7
  name="micro_users",
8
- version="1.8.3",
8
+ version="1.8.6",
9
9
  author="DeBeski",
10
10
  author_email="debeski1@gmail.com",
11
11
  description="Arabic django user management app with abstract user, permissions, and activity logging",
@@ -0,0 +1,9 @@
1
+ from .utils import is_scope_enabled
2
+
3
+ def scope_settings(request):
4
+ """
5
+ Context processor to add scope settings to all templates.
6
+ """
7
+ return {
8
+ 'scope_enabled': is_scope_enabled()
9
+ }
@@ -5,7 +5,7 @@ from django.contrib.auth.models import Permission as Permissions
5
5
  from django.contrib.auth.forms import UserCreationForm, UserChangeForm, PasswordChangeForm, SetPasswordForm
6
6
  from django.contrib.auth import get_user_model
7
7
  from crispy_forms.helper import FormHelper
8
- from crispy_forms.layout import Layout, Field, Div, HTML, Submit
8
+ from crispy_forms.layout import Layout, Field, Div, HTML, Submit, Row
9
9
  from crispy_forms.bootstrap import FormActions
10
10
  from PIL import Image
11
11
  from django.core.exceptions import ValidationError
@@ -165,6 +165,12 @@ class CustomUserCreationForm(UserCreationForm):
165
165
  user_perms = self.user.user_permissions.all() | Permissions.objects.filter(group__user=self.user)
166
166
  self.fields['permissions'].queryset = self.fields['permissions'].queryset.filter(id__in=user_perms.values_list('id', flat=True))
167
167
 
168
+ ScopeSettings = apps.get_model('users', 'ScopeSettings')
169
+ if not ScopeSettings.load().is_enabled:
170
+ self.fields['scope'].disabled = True
171
+ self.fields['scope'].widget = forms.HiddenInput()
172
+ self.fields['scope'].required = False
173
+
168
174
  if self.user and not self.user.is_superuser and self.user.scope:
169
175
  self.fields['scope'].initial = self.user.scope
170
176
  self.fields['scope'].disabled = True
@@ -187,14 +193,15 @@ class CustomUserCreationForm(UserCreationForm):
187
193
  self.fields["email"].label = "البريد الإلكتروني"
188
194
  self.fields["first_name"].label = "الاسم"
189
195
  self.fields["last_name"].label = "اللقب"
190
- self.fields["is_staff"].label = "صلاحيات انشاء و تعديل المستخدمين"
196
+ self.fields["is_staff"].label = "صلاحيات انشاء و تعديل المستخدمين (مسؤول)"
191
197
  self.fields["password1"].label = "كلمة المرور"
192
198
  self.fields["password2"].label = "تأكيد كلمة المرور"
193
199
  self.fields["is_active"].label = "تفعيل الحساب"
194
200
 
195
201
  # Help Texts
196
- self.fields["username"].help_text = "اسم المستخدم يجب أن يكون فريدًا، 50 حرفًا أو أقل. فقط حروف، أرقام و @ . + - _"
202
+ self.fields["username"].help_text = "اسم المستخدم يجب أن يكون فريدًا، 20 حرفًا أو أقل. فقط حروف، أرقام و @ . + - _"
197
203
  self.fields["email"].help_text = "أدخل عنوان البريد الإلكتروني الصحيح"
204
+ self.fields["phone"].help_text = "أدخل رقم الهاتف الصحيح بالصيغة الاتية 09XXXXXXXX"
198
205
  self.fields["is_staff"].help_text = "يحدد ما إذا كان بإمكان المستخدم الوصول إلى قسم ادارة المستخدمين."
199
206
  self.fields["is_active"].help_text = "يحدد ما إذا كان يجب اعتبار هذا الحساب نشطًا."
200
207
  self.fields["password1"].help_text = "كلمة المرور يجب ألا تكون مشابهة لمعلوماتك الشخصية، وأن تحتوي على 8 أحرف على الأقل، وألا تكون شائعة أو رقمية بالكامل.."
@@ -203,21 +210,21 @@ class CustomUserCreationForm(UserCreationForm):
203
210
  # Use Crispy Forms Layout helper
204
211
  self.helper = FormHelper()
205
212
  self.helper.layout = Layout(
206
- "username",
207
- "phone",
208
- "password1",
209
- "password2",
213
+ Row(Field("username", css_class="form-control")),
214
+ Row(Field("password1", css_class="form-control")),
215
+ Row(Field("password2", css_class="form-control")),
210
216
  HTML("<hr>"),
211
- Div(
212
- Div(Field("first_name", css_class="col-md-6"), css_class="col-md-6"),
213
- Div(Field("last_name", css_class="col-md-6"), css_class="col-md-6"),
217
+ Row(
218
+ Div(Field("first_name", css_class="form-control"), css_class="col-md-6"),
219
+ Div(Field("last_name", css_class="form-control"), css_class="col-md-6"),
214
220
  css_class="row"
215
221
  ),
216
- Div(
217
- Div(Field("email", css_class="col-md-6"), css_class="col-md-6"),
218
- Div(Field("scope", css_class="col-md-6"), css_class="col-md-6"),
222
+ Row(
223
+ Div(Field("phone", css_class="form-control"), css_class="col-md-6"),
224
+ Div(Field("email", css_class="form-control"), css_class="col-md-6"),
219
225
  css_class="row"
220
226
  ),
227
+ Row(Field("scope", css_class="form-control")),
221
228
  HTML("<hr>"),
222
229
  Field("permissions", css_class="col-12"),
223
230
  "is_staff",
@@ -233,7 +240,7 @@ class CustomUserCreationForm(UserCreationForm):
233
240
  ),
234
241
  HTML(
235
242
  """
236
- <a href="{% url 'manage_users' %}" class="btn btn-secondary">
243
+ <a href="{% url 'manage_users' %}" class="btn btn-danger">
237
244
  <i class="bi bi-arrow-return-left text-light me-1 h4"></i> إلغـــاء
238
245
  </a>
239
246
  """
@@ -288,11 +295,11 @@ class CustomUserChangeForm(UserChangeForm):
288
295
  self.fields["email"].label = "البريد الإلكتروني"
289
296
  self.fields["first_name"].label = "الاسم الاول"
290
297
  self.fields["last_name"].label = "اللقب"
291
- self.fields["is_staff"].label = "صلاحيات انشاء و تعديل المستخدمين"
298
+ self.fields["is_staff"].label = "صلاحيات انشاء و تعديل المستخدمين (مسؤول)"
292
299
  self.fields["is_active"].label = "الحساب مفعل"
293
300
 
294
301
  # Help Texts
295
- self.fields["username"].help_text = "اسم المستخدم يجب أن يكون فريدًا، 50 حرفًا أو أقل. فقط حروف، أرقام و @ . + - _"
302
+ self.fields["username"].help_text = "اسم المستخدم يجب أن يكون فريدًا، 20 حرفًا أو أقل. فقط حروف، أرقام و @ . + - _"
296
303
  self.fields["email"].help_text = "أدخل عنوان البريد الإلكتروني الصحيح"
297
304
  self.fields["is_staff"].help_text = "يحدد ما إذا كان بإمكان المستخدم الوصول إلى قسم ادارة المستخدمين."
298
305
  self.fields["is_active"].help_text = "يحدد ما إذا كان يجب اعتبار هذا الحساب نشطًا. قم بإلغاء تحديد هذا الخيار بدلاً من الحذف."
@@ -300,6 +307,12 @@ class CustomUserChangeForm(UserChangeForm):
300
307
  if user_instance:
301
308
  self.fields["permissions"].initial = user_instance.user_permissions.all()
302
309
 
310
+ ScopeSettings = apps.get_model('users', 'ScopeSettings')
311
+ if not ScopeSettings.load().is_enabled:
312
+ self.fields['scope'].disabled = True
313
+ self.fields['scope'].widget = forms.HiddenInput()
314
+ self.fields['scope'].required = False
315
+
303
316
  # --- Foolproofing & Role-based logic ---
304
317
  if self.user and not self.user.is_superuser:
305
318
  # 1. Self-Editing Protection (Prevents accidental demotion)
@@ -335,19 +348,19 @@ class CustomUserChangeForm(UserChangeForm):
335
348
  self.helper = FormHelper()
336
349
  self.helper.form_tag = False
337
350
  self.helper.layout = Layout(
338
- "username",
339
- "phone",
351
+ Row(Field("username", css_class="form-control")),
340
352
  HTML("<hr>"),
341
- Div(
342
- Div(Field("first_name", css_class="col-md-6"), css_class="col-md-6"),
343
- Div(Field("last_name", css_class="col-md-6"), css_class="col-md-6"),
353
+ Row(
354
+ Div(Field("first_name", css_class="form-control"), css_class="col-md-6"),
355
+ Div(Field("last_name", css_class="form-control"), css_class="col-md-6"),
344
356
  css_class="row"
345
357
  ),
346
- Div(
347
- Div(Field("email", css_class="col-md-6"), css_class="col-md-6"),
348
- Div(Field("scope", css_class="col-md-6"), css_class="col-md-6"),
358
+ Row(
359
+ Div(Field("phone", css_class="form-control"), css_class="col-md-6"),
360
+ Div(Field("email", css_class="form-control"), css_class="col-md-6"),
349
361
  css_class="row"
350
362
  ),
363
+ Row(Field("scope", css_class="form-control")),
351
364
  HTML("<hr>"),
352
365
  Field("permissions", css_class="col-12"),
353
366
  "is_staff",
@@ -363,14 +376,14 @@ class CustomUserChangeForm(UserChangeForm):
363
376
  ),
364
377
  HTML(
365
378
  """
366
- <a href="{% url 'manage_users' %}" class="btn btn-secondary">
379
+ <a href="{% url 'manage_users' %}" class="btn btn-danger">
367
380
  <i class="bi bi-arrow-return-left text-light me-1 h4"></i> إلغـــاء
368
381
  </a>
369
382
  """
370
383
  ),
371
384
  HTML(
372
385
  """
373
- <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#resetPasswordModal">
386
+ <button type="button" class="btn btn-warning" data-bs-toggle="modal" data-bs-target="#resetPasswordModal">
374
387
  <i class="bi bi-key-fill text-light me-1 h4"></i> إعادة تعيين كلمة المرور
375
388
  </button>
376
389
  """
@@ -0,0 +1,24 @@
1
+ # Generated by Django 5.2.8 on 2026-01-30 21:52
2
+
3
+ from django.db import migrations, models
4
+
5
+
6
+ class Migration(migrations.Migration):
7
+
8
+ dependencies = [
9
+ ('users', '0003_scope_alter_customuser_options_and_more'),
10
+ ]
11
+
12
+ operations = [
13
+ migrations.CreateModel(
14
+ name='ScopeSettings',
15
+ fields=[
16
+ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
17
+ ('is_enabled', models.BooleanField(default=False, verbose_name='تفعيل النطاقات')),
18
+ ],
19
+ options={
20
+ 'verbose_name': 'إعدادات النطاق',
21
+ 'verbose_name_plural': 'إعدادات النطاق',
22
+ },
23
+ ),
24
+ ]
@@ -14,6 +14,24 @@ class Scope(models.Model):
14
14
  class Meta:
15
15
  verbose_name = "نطاق"
16
16
  verbose_name_plural = "النطاقات"
17
+ class ScopeSettings(models.Model):
18
+ is_enabled = models.BooleanField(default=False, verbose_name="تفعيل النطاقات")
19
+
20
+ class Meta:
21
+ verbose_name = "إعدادات النطاق"
22
+ verbose_name_plural = "إعدادات النطاق"
23
+
24
+ def save(self, *args, **kwargs):
25
+ self.pk = 1
26
+ super(ScopeSettings, self).save(*args, **kwargs)
27
+
28
+ @classmethod
29
+ def load(cls):
30
+ obj, created = cls.objects.get_or_create(pk=1)
31
+ return obj
32
+
33
+ def __str__(self):
34
+ return "إعدادات النطاق"
17
35
 
18
36
  class CustomUser(AbstractUser):
19
37
  phone = models.CharField(max_length=15, blank=True, null=True, verbose_name="رقم الهاتف")
@@ -0,0 +1,273 @@
1
+ :root {
2
+ --selection-bg: #dbdbdb;
3
+ --selection-moz-bg: #dbdbdb;
4
+ --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
5
+ --left-bg: rgba(255, 255, 255, 0.85); /* Glassmorphism */
6
+ --left-shadow: rgba(0,0,0,0.05); /* Softer shadow */
7
+ --right-bg: #2b3035; /* Darker accent */
8
+ --right-shadow: rgba(0,0,0,0.1);
9
+ --right-text: #F1F1F2;
10
+ --label-color: #5a6474;
11
+ --input-text: #2c3e50;
12
+ --submit-color: #707075;
13
+ --submit-focus: #575757;
14
+ --submit-active: #4d4d4d;
15
+ --primary-color: #2363c3;
16
+ }
17
+
18
+ ::selection { background: var(--selection-bg); }
19
+ ::-webkit-selection { background: var(--selection-bg); }
20
+ ::-moz-selection { background: var(--selection-moz-bg); }
21
+
22
+ /* REMOVED body styles that break titlebar layout (display: flex, center, etc) */
23
+ /* Instead, we style the page container to center content inside the main content area */
24
+ .page {
25
+ display: flex;
26
+ flex-direction: column;
27
+ height: 100%;
28
+ width: 100%;
29
+ align-items: center;
30
+ justify-content: center;
31
+ min-height: calc(100vh - 100px); /* Ensure vertical centering within available space */
32
+ }
33
+
34
+ /* Gradient background applied to body via style.css or separate logic,
35
+ but since this login.css is likely scoped or loaded on login page,
36
+ we can set background on .page or keep it on body if safe.
37
+ To be safe and avoid breaking layout, we set background on body
38
+ but NOT layout properties. */
39
+ body {
40
+ background: var(--bg-gradient);
41
+ /* No display:flex here to avoid squishing the titlebar */
42
+ }
43
+
44
+ .container {
45
+ height: 480px; /* Increased height */
46
+ margin: 0 auto;
47
+ width: 800px; /* Increased width */
48
+ display: flex;
49
+ background: transparent;
50
+ align-items: center;
51
+ justify-content: center;
52
+ position: relative;
53
+ }
54
+
55
+ @media (max-width: 767px) {
56
+ .container {
57
+ flex-direction: column;
58
+ height: auto;
59
+ width: 90%;
60
+ }
61
+ }
62
+
63
+ .left {
64
+ background: var(--left-bg);
65
+ height: 380px;
66
+ position: absolute;
67
+ left: 50px; /* Overlap effect */
68
+ width: 400px;
69
+ box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
70
+ backdrop-filter: blur(8px);
71
+ -webkit-backdrop-filter: blur(8px);
72
+ border-radius: 20px;
73
+ border: 1px solid rgba(255, 255, 255, 0.18);
74
+ z-index: 2;
75
+ display: flex;
76
+ flex-direction: column;
77
+ justify-content: center;
78
+ }
79
+
80
+ @media (max-width: 767px) {
81
+ .left {
82
+ position: relative;
83
+ width: 100%;
84
+ left: 0;
85
+ margin-bottom: 20px;
86
+ height: auto;
87
+ padding: 40px 0;
88
+ }
89
+ }
90
+
91
+ .right {
92
+ background: var(--right-bg);
93
+ box-shadow: 0 8px 32px 0 var(--right-shadow);
94
+ color: var(--right-text);
95
+ position: absolute;
96
+ right: 50px;
97
+ width: 350px;
98
+ height: 480px;
99
+ border-radius: 20px;
100
+ z-index: 1;
101
+ display: flex;
102
+ align-items: center;
103
+ justify-content: center;
104
+ }
105
+
106
+ @media (max-width: 767px) {
107
+ .right {
108
+ position: relative;
109
+ width: 100%;
110
+ right: 0;
111
+ height: 250px;
112
+ }
113
+ }
114
+
115
+ .form {
116
+ margin: 40px;
117
+ text-align: right; /* RTL */
118
+ width: calc(100% - 80px);
119
+ }
120
+
121
+ label {
122
+ color: var(--label-color);
123
+ display: block;
124
+ font-size: 14px;
125
+ font-weight: 600;
126
+ margin-top: 20px;
127
+ margin-bottom: 8px;
128
+ }
129
+
130
+ input {
131
+ background: rgba(255, 255, 255, 0.5);
132
+ border: 1px solid #e1e8ed;
133
+ border-radius: 8px;
134
+ color: var(--input-text);
135
+ font-size: 16px;
136
+ height: 45px;
137
+ line-height: 45px;
138
+ outline: none !important;
139
+ width: 100%;
140
+ padding: 0 15px; /* Add padding */
141
+ margin-top: 5px; /* Reduced top margin since we use padding */
142
+ margin-bottom: 15px;
143
+ transition: all 0.3s ease;
144
+ }
145
+
146
+ input:focus {
147
+ border-color: var(--primary-color);
148
+ background: white;
149
+ box-shadow: 0 0 0 3px rgba(35, 99, 195, 0.1);
150
+ }
151
+
152
+ input::-moz-focus-inner { border: 0; }
153
+
154
+ #submit {
155
+ color: white;
156
+ margin-top: 30px;
157
+ transition: all 0.3s;
158
+ background-color: var(--submit-color);
159
+ border: none;
160
+ cursor: pointer;
161
+ font-weight: 700;
162
+ letter-spacing: 0.5px;
163
+ box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
164
+ }
165
+
166
+ #submit:hover {
167
+ background-color: var(--submit-focus);
168
+ transform: translateY(-2px);
169
+ }
170
+
171
+ #submit:active { transform: translateY(0); }
172
+
173
+ /* New Utility Classes for specific elements */
174
+ .login-input {
175
+ font-size: 18px !important;
176
+ }
177
+ .login-submit {
178
+ font-size: 18px !important;
179
+ }
180
+ .logo-img {
181
+ width: 80%;
182
+ max-width: 200px;
183
+ opacity: 0.9;
184
+ }
185
+
186
+ @media (max-width: 767px) {
187
+ .logo-img {
188
+ /* Mask the image to color it with the theme color */
189
+ -webkit-mask-image: url("/static/img/login_logo.webp");
190
+ mask-image: url("/static/img/login_logo.webp");
191
+ -webkit-mask-size: contain;
192
+ mask-size: contain;
193
+ -webkit-mask-repeat: no-repeat;
194
+ mask-repeat: no-repeat;
195
+ -webkit-mask-position: center;
196
+ mask-position: center;
197
+ background-color: var(--primal, var(--primary-color));
198
+ /* Hide the original image content so background color shows through mask */
199
+ object-position: -9999px -9999px; /* Fallback to hide original if mask fails or ensuring background color dominates?
200
+ Actually, on an IMG tag, background-color renders BEHIND the content.
201
+ To make this work on an IMG tag, we interpret the img content as the mask
202
+ and the background-color as the fill.
203
+ BUT standard behavior: mask cuts out the element.
204
+ To color it, we need the element to be a block of color.
205
+ So we set background-color and move the object content away?
206
+ No, 'content: ""' is invalid on img.
207
+ The accepted way to recolor an img via CSS only is using mask on a wrapper OR
208
+ using a filter.
209
+ Since I can't easily add a wrapper without editing HTML (templates),
210
+ I will use the mask property directly on the img tag but I need to ensure
211
+ the image content itself doesn't show?
212
+ Wait, 'mask' creates transparency. It doesn't fill with color.
213
+ A BETTER approach for a single IMG tag:
214
+ Use the mask on a pseudo element? No, img tags don't support pseudo elements.
215
+
216
+ CORRECT APPROACH:
217
+ Use `content: url(...)`? No.
218
+ Use `filter: drop-shadow(0 0 0 var(--primal))`? No (adds shadow).
219
+
220
+ The "Mask" trick for coloring an icon usually requires the element to differ.
221
+
222
+ However, since I can edit `login.html`?
223
+ Wait, user said "this element... should change color".
224
+ If I can edit `login.html`, I can add a wrapper.
225
+ But user specified `login.css` context implicitly.
226
+
227
+ Let's try the `mask` approach on the img tag ITSELF:
228
+ If you set `mask-image` on an element, the element is clipped.
229
+ The visible part is the element's own content (the image) where the mask is opaque.
230
+ So `mask-image: url(self)` just shows the original image.
231
+
232
+ To RECOLOR it, we need a block of color `background-color: var(--primal)`
233
+ and mask *that* block with the image shape.
234
+ We can turn the `img` into a block of color by:
235
+ 1. Setting `padding` equal to size? No.
236
+ 2. Hiding the `src`?
237
+
238
+ Alternative: `filter: sepia(1) saturate(10000%) hue-rotate(...)`
239
+ This is hard to match exact theme color.
240
+
241
+ Let's look at `login.html` to see if I can add a class or wrapper.
242
+ Actually, I'll use the `mask` trick by making the img transparent?
243
+ No.
244
+
245
+ Okay, I will replace the img with a div in `login.html`?
246
+ That might break things.
247
+
248
+ Let's stick to CSS if possible.
249
+ Ah! `mask-image` works on the *box* of the element.
250
+ If we can make the element's content invisible (e.g. `object-position` off screen)
251
+ but keep the box size, then `background-color` fills the box.
252
+ Then `mask-image` cuts the background.
253
+
254
+ Let's try:
255
+ height: (keep same); width: (keep same);
256
+ object-position: -99999px; (moves the image content away)
257
+ background-color: var(--primal);
258
+ mask-image: url(...);
259
+ mask-size: contain;
260
+ mask-repeat: no-repeat;
261
+ mask-position: center;
262
+
263
+ This works on Chrome/Firefox for `img` tags.
264
+ */
265
+
266
+ height: 100px; /* Need explicit height if object-position moves content? */
267
+ /* Actually .logo-img has width 80%, max-width 200px. */
268
+ /* WebP aspect ratio might define height. */
269
+ /* If I move content, does intrinsic size remain? Usually yes. */
270
+ object-position: -99999px 0;
271
+ background-color: var(--primal, var(--primary-color));
272
+ }
273
+ }