imran-cloud-erp-auth 0.1.0__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.
@@ -0,0 +1,5 @@
1
+ Metadata-Version: 2.1
2
+ Name: imran_cloud_erp_auth
3
+ Version: 0.1.0
4
+ Summary: Reusable Django registration module
5
+ Author: Imran Murshad
@@ -0,0 +1 @@
1
+ This is ERP system Website which is Developed in Python and Django
@@ -0,0 +1 @@
1
+ from .services import register_user
@@ -0,0 +1,37 @@
1
+ from django.contrib.auth.models import User
2
+ from .models import UserProfile # optional if reusable
3
+
4
+ def register_user(data):
5
+ full_name = data.get("full_name")
6
+ email = data.get("email")
7
+ username = data.get("username")
8
+ password = data.get("password")
9
+ confirm_password = data.get("confirm_password")
10
+ question = data.get("question")
11
+ answer = data.get("answer")
12
+
13
+ if not all([full_name, email, username, password, confirm_password, question, answer]):
14
+ return {"error": "All fields are required"}
15
+
16
+ if password != confirm_password:
17
+ return {"error": "Passwords do not match"}
18
+
19
+ if User.objects.filter(username=username).exists():
20
+ return {"error": "Username already exists"}
21
+
22
+ if User.objects.filter(email=email).exists():
23
+ return {"error": "Email already registered"}
24
+
25
+ user = User.objects.create_user(
26
+ username=username, password=password, email=email
27
+ )
28
+
29
+ UserProfile.objects.create(
30
+ user=user,
31
+ full_name=full_name,
32
+ email=email,
33
+ security_question=question,
34
+ security_answer=answer,
35
+ )
36
+
37
+ return {"success": True, "user": user}
File without changes
@@ -0,0 +1,5 @@
1
+ Metadata-Version: 2.1
2
+ Name: imran-cloud-erp-auth
3
+ Version: 0.1.0
4
+ Summary: Reusable Django registration module
5
+ Author: Imran Murshad
@@ -0,0 +1,12 @@
1
+ README.md
2
+ pyproject.toml
3
+ setup.py
4
+ cloud_erp_auth/__init__.py
5
+ cloud_erp_auth/services.py
6
+ cloud_erp_auth/validators.py
7
+ cloud_erp_auth/views.py
8
+ imran_cloud_erp_auth.egg-info/PKG-INFO
9
+ imran_cloud_erp_auth.egg-info/SOURCES.txt
10
+ imran_cloud_erp_auth.egg-info/dependency_links.txt
11
+ imran_cloud_erp_auth.egg-info/requires.txt
12
+ imran_cloud_erp_auth.egg-info/top_level.txt
File without changes
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,10 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ setup(
4
+ name="imran_cloud_erp_auth",
5
+ version="0.1.0",
6
+ packages=find_packages(),
7
+ install_requires=["django"],
8
+ author="Imran Murshad",
9
+ description="Reusable Django registration module",
10
+ )