├── projects ├── artisans │ ├── backend │ │ ├── backend │ │ │ ├── __init__.py │ │ │ ├── asgi.py │ │ │ ├── wsgi.py │ │ │ ├── urls.py │ │ │ └── settings.py │ │ ├── authentication │ │ │ ├── __init__.py │ │ │ ├── migrations │ │ │ │ ├── __init__.py │ │ │ │ └── __pycache__ │ │ │ │ │ └── __init__.cpython-311.pyc │ │ │ ├── models.py │ │ │ ├── tests.py │ │ │ ├── admin.py │ │ │ ├── apps.py │ │ │ ├── urls.py │ │ │ ├── serializers.py │ │ │ └── views.py │ │ ├── .gitignore │ │ ├── db.sqlite3 │ │ ├── requirements.txt │ │ ├── README.md │ │ └── manage.py │ └── README.md ├── README.md └── readme_example.md ├── SECURITY.md ├── .github ├── FUNDING.yml └── ISSUE_TEMPLATE │ └── show-interest-in-a-project.md ├── LICENSE ├── README.md ├── CONTRIBUTING.md └── CODE_OF_CONDUCT.md /projects/artisans/backend/backend/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /projects/artisans/backend/authentication/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /projects/artisans/backend/authentication/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /projects/artisans/backend/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | venv/ 3 | db.sqlite3 4 | artisan_client_secret.json -------------------------------------------------------------------------------- /projects/artisans/backend/authentication/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /projects/artisans/backend/authentication/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | Please do not create GitHub issues for security vulnerabilities. Instead, report them via madtechnow@gmail.com 2 | -------------------------------------------------------------------------------- /projects/artisans/backend/authentication/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /projects/artisans/backend/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichealCodez/awesome-project-ideas/HEAD/projects/artisans/backend/db.sqlite3 -------------------------------------------------------------------------------- /projects/artisans/backend/authentication/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class AuthenticationConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'authentication' 7 | -------------------------------------------------------------------------------- /projects/artisans/backend/requirements.txt: -------------------------------------------------------------------------------- 1 | Django==5.0.1 2 | django-allauth==0.60.0 3 | django-extensions==3.2.3 4 | djangorestframework==3.14.0 5 | PyJWT==2.8.0 6 | django-cors-headers==4.3.1 7 | google-auth==2.26.2 -------------------------------------------------------------------------------- /projects/artisans/backend/authentication/migrations/__pycache__/__init__.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MichealCodez/awesome-project-ideas/HEAD/projects/artisans/backend/authentication/migrations/__pycache__/__init__.cpython-311.pyc -------------------------------------------------------------------------------- /projects/artisans/backend/README.md: -------------------------------------------------------------------------------- 1 | # Artisan Auth API With Django 2 | 3 | ## Description 4 | This is the authentication folder for the artisan project. 5 | Used Jason Web Token (JWT) to create authentication APIs for this prject. 6 | 7 | # Implemented Features: 8 | **Register New User** 9 | **Login** 10 | **Logout** 11 | **Reset Password** 12 | 13 | -------------------------------------------------------------------------------- /projects/artisans/backend/backend/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for backend project. 3 | 4 | It exposes the ASGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.asgi import get_asgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /projects/artisans/backend/backend/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for backend project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /projects/artisans/backend/backend/urls.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from django.urls import path, include 3 | 4 | urlpatterns = [ 5 | # Below is the adim url. This is where you can access the admin panel. 6 | path('admin/', admin.site.urls), 7 | 8 | # Below is the url for the authentication app. Add the 'api/authentication' 9 | # in your link address then the other authentication urls to visit its page. 10 | path('api/user/', include('authentication.urls')), 11 | 12 | # Use this link to login with google 13 | # Enter --> "http://127.0.0.1:8000/accounts/login/" 14 | path('accounts/', include('allauth.urls')), 15 | ] 16 | -------------------------------------------------------------------------------- /projects/artisans/backend/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """Django's command-line utility for administrative tasks.""" 3 | import os 4 | import sys 5 | 6 | 7 | def main(): 8 | """Run administrative tasks.""" 9 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings') 10 | try: 11 | from django.core.management import execute_from_command_line 12 | except ImportError as exc: 13 | raise ImportError( 14 | "Couldn't import Django. Are you sure it's installed and " 15 | "available on your PYTHONPATH environment variable? Did you " 16 | "forget to activate a virtual environment?" 17 | ) from exc 18 | execute_from_command_line(sys.argv) 19 | 20 | 21 | if __name__ == '__main__': 22 | main() 23 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [MichealCodez] 4 | # patreon: # Replace with a single Patreon username 5 | # open_collective: # Replace with a single Open Collective username 6 | # ko_fi: # Replace with a single Ko-fi username 7 | # tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | # community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | # liberapay: # Replace with a single Liberapay username 10 | # issuehunt: # Replace with a single IssueHunt username 11 | # otechie: # Replace with a single Otechie username 12 | # lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 13 | # custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 14 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/show-interest-in-a-project.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Show Interest in a project 3 | about: A template to show your interest in working on a project. 4 | title: Interested In [project name] 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | # Project Interest 11 | 12 | **Project Name:** 13 | Provide the name of the project you are interested in working on. 14 | 15 | **Inspiration:** 16 | Share what inspires you to work on this particular project. What aspects of the idea resonate with you? 17 | 18 | **Tech Stack:** 19 | List the technologies or tools you plan to use for implementing this project. 20 | 21 | **What Will You Work On?** 22 | Briefly describe the specific aspect or feature of the project that you plan to work on. 23 | 24 | --- 25 | 26 | By submitting this issue, I agree to follow the [Code of Conduct](../CODE_OF_CONDUCT.md) of this repository. 27 | -------------------------------------------------------------------------------- /projects/artisans/backend/authentication/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | from .views import RegisterUserView, LoginUserView, UserView, LogoutView, ResetPasswordView 3 | 4 | urlpatterns = [ 5 | # This is the url for the register page. Add the 'register-account' in your link 6 | path('register-account/', RegisterUserView.as_view(), name='register'), 7 | 8 | # This is the url for the login page. Add the '' in your link. 9 | path('login/', LoginUserView.as_view(), name='login'), 10 | 11 | # This is the url for the user page. Add the 'user' in your link. 12 | path('user-details/', UserView.as_view(), name='user'), 13 | 14 | # This is the url for the logout page. Add the 'logout' in your link. 15 | path('logout/', LogoutView.as_view(), name='logout'), 16 | 17 | # This is the url for the reset password page. Add the 'reset-password' in your link. 18 | path('reset-password/', ResetPasswordView.as_view(), name='reset-password'), 19 | ] -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Micheal David 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /projects/README.md: -------------------------------------------------------------------------------- 1 | 2 | # Projects 3 | 4 | ## Description 5 | 6 | Welcome to the project folder for **List of projects**! This space is dedicated to discussing and developing ideas for an exciting project. Whether you're a developer, designer, or enthusiast, your contributions are valued and can help bring this project to life. 7 | 8 | ## Project Overview 9 | 10 | Provide a brief overview of the project. What problem does it solve? What are the main features and functionalities? Feel free to include any relevant information that sets the context for the project. 11 | 12 | ## Getting Started 13 | 14 | If you're interested in contributing to or working on any project here, follow the guidelines outlined in our [Contributing Guidelines](../CONTRIBUTING.md). 15 | 16 | ## Contributors 17 | 18 | Thanks to all the [contributors](https://github.com/MichealCodez/awesome-project-ideas/graphs/contributors) who have helped make this project awesome! 19 | 20 | ## Code of Conduct 21 | 22 | Please read and adhere to our [Code of Conduct](../CODE_OF_CONDUCT.md). We aim to foster a positive and inclusive community. 23 | 24 | ## Let's Collaborate! 25 | 26 | We welcome your ideas, feedback, and contributions. Let's work together to make this project a success! 🚀 27 | -------------------------------------------------------------------------------- /projects/readme_example.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "[Project Idea] - Your Project Idea Title" 3 | about: Very short description of what the project is about 4 | --- 5 | 6 | ## Project Idea 7 | 8 | **Description:** 9 | Provide a clear and concise description of the project idea. Include the problem it solves, potential features, and any relevant information. 10 | 11 | **Motivation:** 12 | Explain why this project idea is interesting and how it could benefit the community. 13 | 14 | **Skills Needed:** 15 | List any specific skills or expertise required for this project. This could include programming languages, frameworks, design skills, etc. 16 | 17 | **Additional Information:** 18 | Add any extra details or considerations that might be relevant to the project idea. 19 | 20 | ## Proposed Implementation (Optional) 21 | 22 | If you have a specific approach or implementation in mind, outline it here. Otherwise, this section can be left blank. 23 | 24 | --- 25 | 26 | **Note:** Before submitting, make sure to check if a similar project idea has been proposed. If so, consider joining efforts by contributing to the existing proposal. 27 | 28 | By submitting this issue, I agree to follow the [Code of Conduct](https://github.com/MichealCodez/awesome-project-ideas/blob/main/CODE_OF_CONDUCT.md) of this repository. 29 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 |

Welcome to the Awesome Project Ideas Repository! 🚀

5 |

This repository is a space for creative minds to collaborate on innovative project ideas and bring them to life. Whether you're an experienced developer or a newcomer, we invite you to contribute your ideas and expertise to make this repository a hub of inspiration and collaboration.

6 |
7 | 8 | ## How to Contribute 9 | 10 | For detailed instructions on how to contribute, please check our [Contributing Guidelines](CONTRIBUTING.md). 11 | If you are feeling less confident about contributing, consider exploring this [repository](https://github.com/EddieHubCommunity/open-source-practice) to become more familiar with Open Source. 12 | 13 | ## Code of Conduct 14 | 15 | Please note that we have a [Code of Conduct](CODE_OF_CONDUCT.md), and contributors are expected to adhere to it. By participating in this project, you agree to abide by its terms. 16 | 17 | ## Let's Build Amazing Projects Together! 18 | 19 | We appreciate your interest and look forward to seeing your creativity come to life. Let's make this repository a source of inspiration and collaboration. Happy coding! 🌟 20 | ### Don't Forget to Star This Repo😉 21 | -------------------------------------------------------------------------------- /projects/artisans/backend/authentication/serializers.py: -------------------------------------------------------------------------------- 1 | from rest_framework import serializers 2 | from django.contrib.auth.models import User 3 | 4 | 5 | # This is the serializer class for registering a user. 6 | class RegisterUserSerializer(serializers.ModelSerializer): 7 | class Meta: 8 | model = User # We defined the model to be the User model(default django User model). 9 | fields = ['id', 'first_name', 'last_name', 'username', 'email', 'password'] # Fields we need to register a user. 10 | 11 | # This code snippet is used to make the password field write only(not among user's data that'll be returned) for security reasons. 12 | extra_kwargs = { 13 | 'password':{'write_only':True} 14 | } 15 | 16 | # Let us hash the password for security reasons. 17 | def create(self, validated_data): 18 | password = validated_data.pop('password', None) # We are getting the password from the validated data. 19 | instance = self.Meta.model(**validated_data) # We are creating an instance of the User model with the validated data. 20 | if password is not None: 21 | instance.set_password(password) # We are hashing the password here. 22 | instance.save() # We are saving the instance. 23 | return instance # We are returning the instance. 24 | 25 | # This second serializer class is for resetting a forgotten password using the email field. 26 | class ResetPasswordSerializer(serializers.Serializer): 27 | user = User 28 | email = serializers.EmailField(required=True) 29 | new_password = serializers.CharField(max_length=68, required=True) 30 | confirm_password = serializers.CharField(max_length=68, required=True) 31 | -------------------------------------------------------------------------------- /projects/artisans/README.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Artisans 3 | about: Open Source Alternative to Upwork, Fiverr, etc. 4 | --- 5 | 6 | ## Project Idea 7 | 8 | **Description:** 9 | Artisans aims to be an open-source alternative to popular freelancing platforms like Upwork and Fiverr. In a world increasingly reliant on freelance talent, Artisans seeks to provide a collaborative and transparent platform for connecting skilled individuals with diverse projects. By fostering a community-driven environment, Artisans aims to empower freelancers and clients alike to collaborate on a wide range of projects, from creative endeavors to technical tasks. 10 | 11 | **Motivation:** 12 | Artisans is not just a platform; it's a community-driven ecosystem that values collaboration, diversity, and transparency. By providing an open-source alternative to traditional freelancing platforms, Artisans strives to create a space where creativity flourishes, talents are recognized, and projects thrive. 13 | 14 | **Skills Needed:** 15 | 16 | - Frontend: [React, Vue.js, Angular, etc.] 17 | - Backend: [Node.js, Django, Ruby on Rails, etc.] 18 | - Database: [MySQL, PostgreSQL, MongoDB, etc.] 19 | - Collaboration Tools: [Slack, Trello, Jira, etc.] 20 | 21 | **Additional Information:** 22 | Artisans is an open-source project, and we welcome contributions from developers, designers, and enthusiasts. If you believe in the vision of creating a collaborative space for freelancers and clients, join us in building Artisans together! 23 | 24 | ## Proposed Implementation (Optional) 25 | 26 | - User-friendly interface for freelancers and clients to create profiles and showcase their skills or project requirements. 27 | - Seamless project discovery and matching based on skills, interests, and project specifications. 28 | - Transparent and fair payment systems to ensure equitable compensation for freelancers. 29 | - Collaboration tools, such as messaging and project management, to facilitate smooth communication and workflow. 30 | - Open-source nature encourages community contributions, improvements, and customization. 31 | 32 | --- 33 | 34 | By submitting this issue, I agree to follow the [Code of Conduct](https://github.com/MichealCodez/awesome-project-ideas/blob/main/CODE_OF_CONDUCT.md) of this repository. 35 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Contributing to Project Ideas 4 | 5 | Thank you for considering contributing to our project! We welcome your ideas and contributions to make this repository a collaborative space for innovative projects. 6 | 7 | ## How to Contribute 8 | 9 | To contribute to this project, follow these steps: 10 | 11 | ### Contributing Project Ideas 12 | 13 | 1. **Fork the Repository:** 14 | - Click on the "Fork" button at the top right corner of this repository's page. This will create a copy of the repository in your GitHub account. 15 | 16 | 2. **Create a Branch:** 17 | - Create a new branch on your forked repository. You can name the branch in a way that describes the purpose of the changes you intend to make. 18 | 19 | 3. **Add Your Project Idea:** 20 | - Inside the [projects](projects) folder, create a new folder with the name of your project idea. 21 | - Create a `README.md` file inside the project folder and provide a detailed explanation of your project idea. Include any relevant information, such as the problem it solves, technologies involved, and potential features. See [readme example](projects/readme_example.md) for template. 22 | 23 | 4. **Commit Changes:** 24 | - Commit your changes to the branch you created in your forked repository. 25 | 26 | 5. **Create a Pull Request:** 27 | - Open a pull request (PR) from your branch to the main repository. Provide a clear and concise title and description for your PR, summarizing the changes you made. 28 | 29 | ### Working on Project Ideas 30 | 31 | If you're interested in working on a specific project idea: 32 | 33 | 1. **Open an Issue:** 34 | - Create a new issue in this repository, specifying the project idea you want to work on. Include the link to the `readme.md` file of the project idea. 35 | 36 | 2. **Collaborate:** 37 | - Engage in discussions on the issue to coordinate with other contributors interested in the same project idea. 38 | 39 | 3. **Fork and Contribute:** 40 | - Follow the steps mentioned above to fork the repository, create a branch, and contribute to the project idea. 41 | 42 | 4. **Create a Pull Request:** 43 | - Once your contribution is ready, create a pull request to merge your changes into the main repository. 44 | 45 | ## Code of Conduct 46 | 47 | Please note that we have a [Code of Conduct](CODE_OF_CONDUCT.md), and contributors are expected to adhere to it. By participating in this project, you agree to abide by its terms. 48 | 49 | We appreciate your contribution and look forward to building amazing projects together! 50 | -------------------------------------------------------------------------------- /projects/artisans/backend/backend/settings.py: -------------------------------------------------------------------------------- 1 | from pathlib import Path 2 | 3 | # Build paths inside the project like this: BASE_DIR / 'subdir'. 4 | BASE_DIR = Path(__file__).resolve().parent.parent 5 | 6 | 7 | # Quick-start development settings - unsuitable for production 8 | # See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/ 9 | 10 | # SECURITY WARNING: keep the secret key used in production secret! 11 | SECRET_KEY = 'django-insecure-ho4ov!v$q7otxm=4)5r^=-w1jj3cmj9$r0o8ual-fyyav+_5rv' 12 | 13 | # SECURITY WARNING: don't run with debug turned on in production! 14 | DEBUG = True 15 | 16 | ALLOWED_HOSTS = [] 17 | 18 | # To avoid errors when signing in with google. 19 | SITE_ID = 2 20 | 21 | # Application definition 22 | INSTALLED_APPS = [ 23 | 'django.contrib.admin', 24 | 'django.contrib.auth', 25 | 'django.contrib.contenttypes', 26 | 'django.contrib.sessions', 27 | 'django.contrib.messages', 28 | 'django.contrib.staticfiles', 29 | 'authentication.apps.AuthenticationConfig', 30 | 31 | 'rest_framework', 32 | 'corsheaders', 33 | 34 | 'allauth', 35 | 'allauth.account', 36 | 'allauth.socialaccount', 37 | 'allauth.socialaccount.providers.google', 38 | ] 39 | 40 | MIDDLEWARE = [ 41 | 'django.middleware.security.SecurityMiddleware', 42 | 'django.contrib.sessions.middleware.SessionMiddleware', 43 | 'django.middleware.common.CommonMiddleware', 44 | 'django.middleware.csrf.CsrfViewMiddleware', 45 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 46 | 'django.contrib.messages.middleware.MessageMiddleware', 47 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 48 | 49 | 'corsheaders.middleware.CorsMiddleware', # We added this line to enable cors. 50 | 'allauth.account.middleware.AccountMiddleware', 51 | ] 52 | 53 | # This is specifying the social account providers. 54 | SOCIALACCOUNT_PROVIDERS = { 55 | 'google': { 56 | 'SCOPE': [ 57 | 'profile', 58 | 'email', 59 | ], 60 | 'AUTH_PARAMS': { 61 | 'access_type': 'online', 62 | } 63 | } 64 | } 65 | 66 | ROOT_URLCONF = 'backend.urls' 67 | 68 | TEMPLATES = [ 69 | { 70 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 71 | 'DIRS': [], 72 | 'APP_DIRS': True, 73 | 'OPTIONS': { 74 | 'context_processors': [ 75 | 'django.template.context_processors.debug', 76 | 'django.template.context_processors.request', 77 | 'django.contrib.auth.context_processors.auth', 78 | 'django.contrib.messages.context_processors.messages', 79 | ], 80 | }, 81 | }, 82 | ] 83 | 84 | WSGI_APPLICATION = 'backend.wsgi.application' 85 | 86 | 87 | # Database 88 | # https://docs.djangoproject.com/en/4.2/ref/settings/#databases 89 | 90 | DATABASES = { 91 | 'default': { 92 | 'ENGINE': 'django.db.backends.sqlite3', 93 | 'NAME': BASE_DIR / 'db.sqlite3', 94 | } 95 | } 96 | 97 | 98 | # Password validation 99 | # https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators 100 | 101 | AUTH_PASSWORD_VALIDATORS = [ 102 | { 103 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 104 | }, 105 | { 106 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 107 | }, 108 | { 109 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 110 | }, 111 | { 112 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 113 | }, 114 | ] 115 | 116 | 117 | # Internationalization 118 | # https://docs.djangoproject.com/en/4.2/topics/i18n/ 119 | 120 | LANGUAGE_CODE = 'en-us' 121 | 122 | TIME_ZONE = 'UTC' 123 | 124 | USE_I18N = True 125 | 126 | USE_TZ = True 127 | 128 | 129 | # Static files (CSS, JavaScript, Images) 130 | # https://docs.djangoproject.com/en/4.2/howto/static-files/ 131 | 132 | STATIC_URL = 'static/' 133 | 134 | # Default primary key field type 135 | # https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field 136 | 137 | DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' 138 | 139 | # We added these two line to enable cors. 140 | CORS_ORIGIN_ALLOW_ALL = True 141 | CORS_DEFAULT_ALLOW_CREDENTIALS = True 142 | 143 | AUTHENTICATION_BACKENDS = ( 144 | 'django.contrib.auth.backends.ModelBackend', 145 | 'allauth.account.auth_backends.AuthenticationBackend', 146 | ) 147 | 148 | # This is to specify the url to redirect to after login and logout. 149 | LOGIN_REDIRECT_URL = '/' 150 | LOGOUT_REDIRECT_URL = '/' -------------------------------------------------------------------------------- /projects/artisans/backend/authentication/views.py: -------------------------------------------------------------------------------- 1 | from rest_framework.views import APIView 2 | from .serializers import RegisterUserSerializer, ResetPasswordSerializer 3 | from rest_framework.response import Response 4 | from rest_framework.exceptions import AuthenticationFailed 5 | from django.contrib.auth.models import User 6 | import jwt 7 | from datetime import datetime, timedelta 8 | 9 | # This is the view logic for registering a user. 10 | # We defined the class and it inherits from the APIView class. 11 | class RegisterUserView(APIView): 12 | def post(self, request): # We defined a post method that takes in a request from a user. 13 | # We defined a serializer variable that takes in the RegisterUserSerializer class and passes in the request data. 14 | serializer = RegisterUserSerializer(data=request.data) 15 | serializer.is_valid(raise_exception=True) # We are checking if the serializer is valid(we raise an exception if it is not valid). 16 | serializer.save() # We save the serializer. 17 | return Response(serializer.data) # We return the serializer data. 18 | 19 | # This is the view logic for logging a user in. 20 | class LoginUserView(APIView): 21 | def post(self, request): # We defined a post method that takes in a request from a user. 22 | email = request.data['email'] # We are getting the inputted email from the request data. 23 | password = request.data['password'] # We are getting the inputted password from the request data. 24 | 25 | # Let's check if the user exists in our database. 26 | user = User.objects.filter(email=email).first() 27 | if user is None: 28 | raise AuthenticationFailed('User not found!') 29 | 30 | # Let's check if the password is correct. 31 | if not user.check_password(password): 32 | raise AuthenticationFailed('Incorrect password!') 33 | 34 | # Let's create a payload variable that takes in the user's id and the current time. 35 | payload = { 36 | 'id':user.id, 37 | 'exp':datetime.utcnow() + timedelta(minutes=60), 38 | 'iat':datetime.utcnow() 39 | } 40 | 41 | # Let's create a token variable that takes in the payload and the secret key. 42 | token = jwt.encode(payload, 'secret', algorithm='HS256') 43 | response = Response() 44 | 45 | # We are setting the cookie to the token. 46 | response.set_cookie(key='jwt', value=token, httponly=True) 47 | 48 | # We are returning the response data and making sure it is in string format. 49 | response.data = { 50 | 'jwt':token.encode('utf8') 51 | } 52 | return response 53 | 54 | # This is the view logic to retrieve a user's data using the token. 55 | class UserView(APIView): 56 | def get(self, request): 57 | token = request.COOKIES.get('jwt') 58 | if not token: 59 | raise AuthenticationFailed('Unauthenticated!') 60 | 61 | # We are getting the payload from the token. 62 | try: 63 | payload = jwt.decode(token, 'secret', algorithms=['HS256']) 64 | except jwt.ExpiredSignatureError: 65 | raise AuthenticationFailed('Unauthenticated!') 66 | 67 | # We are getting the user from the payload. 68 | user = User.objects.filter(id=payload['id']).first() 69 | serializer = RegisterUserSerializer(user) 70 | return Response(serializer.data) 71 | 72 | # This is the view logic to logout a user. 73 | class LogoutView(APIView): 74 | def post(self, request): 75 | response = Response() 76 | response.delete_cookie('jwt') # We are deleting the cookie. 77 | 78 | # We are returning the response data with a success status message. 79 | response.data = { 80 | 'message':'Logout is successful' 81 | } 82 | return response 83 | 84 | # This is the logic for resetting a forgotten password. 85 | class ResetPasswordView(APIView): 86 | def post(self, request): 87 | serializer = ResetPasswordSerializer(data=request.data) 88 | serializer.is_valid(raise_exception=True) 89 | 90 | # We are getting the user from the email. 91 | user = User.objects.filter(email=serializer.data['email']).first() 92 | if user is None: 93 | raise AuthenticationFailed('User not found!') 94 | 95 | # Lets check if the passwords match. 96 | if serializer.data['new_password'] != serializer.data['confirm_password']: 97 | raise AuthenticationFailed('Passwords do not match!') 98 | 99 | # Let's set the new password. 100 | user.set_password(serializer.data['new_password']) 101 | user.save() # We are saving the user. 102 | return Response( 103 | {'message':'Password reset is successful!'} 104 | ) -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, religion, or sexual identity 10 | and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | * Demonstrating empathy and kindness toward other people 21 | * Being respectful of differing opinions, viewpoints, and experiences 22 | * Giving and gracefully accepting constructive feedback 23 | * Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | * Focusing on what is best not just for us as individuals, but for the 26 | overall community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | * The use of sexualized language or imagery, and sexual attention or 31 | advances of any kind 32 | * Trolling, insulting or derogatory comments, and personal or political attacks 33 | * Public or private harassment 34 | * Publishing others' private information, such as a physical or email 35 | address, without their explicit permission 36 | * Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards of 42 | acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies when 54 | an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official e-mail address, 56 | posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at 63 | madtechnow@gmail.com. 64 | All complaints will be reviewed and investigated promptly and fairly. 65 | 66 | All community leaders are obligated to respect the privacy and security of the 67 | reporter of any incident. 68 | 69 | ## Enforcement Guidelines 70 | 71 | Community leaders will follow these Community Impact Guidelines in determining 72 | the consequences for any action they deem in violation of this Code of Conduct: 73 | 74 | ### 1. Correction 75 | 76 | **Community Impact**: Use of inappropriate language or other behavior deemed 77 | unprofessional or unwelcome in the community. 78 | 79 | **Consequence**: A private, written warning from community leaders, providing 80 | clarity around the nature of the violation and an explanation of why the 81 | behavior was inappropriate. A public apology may be requested. 82 | 83 | ### 2. Warning 84 | 85 | **Community Impact**: A violation through a single incident or series 86 | of actions. 87 | 88 | **Consequence**: A warning with consequences for continued behavior. No 89 | interaction with the people involved, including unsolicited interaction with 90 | those enforcing the Code of Conduct, for a specified period of time. This 91 | includes avoiding interactions in community spaces as well as external channels 92 | like social media. Violating these terms may lead to a temporary or 93 | permanent ban. 94 | 95 | ### 3. Temporary Ban 96 | 97 | **Community Impact**: A serious violation of community standards, including 98 | sustained inappropriate behavior. 99 | 100 | **Consequence**: A temporary ban from any sort of interaction or public 101 | communication with the community for a specified period of time. No public or 102 | private interaction with the people involved, including unsolicited interaction 103 | with those enforcing the Code of Conduct, is allowed during this period. 104 | Violating these terms may lead to a permanent ban. 105 | 106 | ### 4. Permanent Ban 107 | 108 | **Community Impact**: Demonstrating a pattern of violation of community 109 | standards, including sustained inappropriate behavior, harassment of an 110 | individual, or aggression toward or disparagement of classes of individuals. 111 | 112 | **Consequence**: A permanent ban from any sort of public interaction within 113 | the community. 114 | 115 | ## Attribution 116 | 117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 118 | version 2.0, available at 119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 120 | 121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct 122 | enforcement ladder](https://github.com/mozilla/diversity). 123 | 124 | [homepage]: https://www.contributor-covenant.org 125 | 126 | For answers to common questions about this code of conduct, see the FAQ at 127 | https://www.contributor-covenant.org/faq. Translations are available at 128 | https://www.contributor-covenant.org/translations. 129 | --------------------------------------------------------------------------------