-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
163 additions
and
30 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from django.contrib.auth.backends import BaseBackend | ||
from django.http import HttpRequest | ||
|
||
|
||
class PhoneEmailOrAccountNumberAuthBackend(BaseBackend): | ||
""" | ||
Authenticates a user into the platform using the user's assigned | ||
unique account number, email address or phone number | ||
""" | ||
|
||
def authenticate(self, request, username, password, *args, **kwargs): | ||
""" | ||
Authenticate a user based on the username and password | ||
""" | ||
pass |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
from rest_framework import serializers | ||
from django.conf import settings | ||
|
||
User = settings.AUTH_USER_MODEL | ||
|
||
from src.paycheck.core.models import UserProfile | ||
|
||
|
||
class UserSerializer(serializers.ModelSerializer): | ||
|
||
class Meta: | ||
model = User | ||
|
||
|
||
class UserProfileSerializer(serializers.ModelSerializer): | ||
user_data = UserSerializer() | ||
|
||
class Meta: | ||
model = UserProfile | ||
exclude = ("id",) | ||
|
||
|
||
class WritableUserProfileSerializer(serializers.Serializer): | ||
""" | ||
This serializer is used to create or update a user profile. | ||
Do not use this serializer in READ operation contexts for retrieving | ||
user information as it may display sensitive information. | ||
""" | ||
|
||
user_data = UserSerializer() | ||
|
||
def create(self, validated_data): | ||
user_data = validated_data.pop("user_data") | ||
user = User.objects.create(**user_data) | ||
user_profile = UserProfile.objects.create(user=user, **validated_data) | ||
return user_profile | ||
|
||
def update(self, instance, validated_data): | ||
user_data = validated_data.pop("user_data") | ||
user = instance.user | ||
user.username = user_data.get("username", user.username) | ||
user.email = user_data.get("email", user.email) | ||
user.save() | ||
instance.__dict__.update(**validated_data) | ||
instance.save() | ||
return instance |
File renamed without changes.
2 changes: 0 additions & 2 deletions
2
backend/paycheck/src/paycheck/core/views.py → .../paycheck_core/src/paycheck/core/views.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
from django.shortcuts import render | ||
|
||
# Create your views here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.