Skip to content
Snippets Groups Projects
Commit 2e517f24 authored by Chris Li's avatar Chris Li
Browse files

Env modified, login bux fixed.

parent fab1e0e1
Branches chris/feature/user-auth-api
No related tags found
1 merge request!1User Authentication Feature Added
......@@ -49,7 +49,7 @@ git merge <branch-name>
- [ ] Install [Miniconda](https://conda.io/projects/conda/en/stable/user-guide/install/download.html) or [Anaconda](https://www.anaconda.com/) to manage your python packages.
- [ ] Create a virtual env via conda: `conda create --name <env> --file requirements.txt`.
- [ ] Create a virtual env via conda: `conda env create -f environment.yml`.
- [ ] Start the Django server:
......
# Generated by Django 4.1 on 2023-01-20 17:39
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django_countries.fields
import django_extensions.db.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0012_alter_user_first_name_max_length'),
]
operations = [
migrations.CreateModel(
name='Profile',
fields=[
('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, verbose_name='created')),
('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, verbose_name='modified')),
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, serialize=False, to=settings.AUTH_USER_MODEL)),
('bio', models.TextField(blank=True)),
('birthday', models.DateField(null=True, verbose_name='Birthday')),
('country', django_countries.fields.CountryField(max_length=2, null=True, verbose_name='Country')),
('city', models.CharField(max_length=100, verbose_name='City in English')),
('affiliation', models.CharField(max_length=100, verbose_name='Name of your organization in English')),
('photo', models.ImageField(blank=True, default='https://static.productionready.io/images/smiley-cyrus.jpg', max_length=100000, null=True, upload_to='media/')),
],
options={
'get_latest_by': 'modified',
'abstract': False,
},
),
]
......@@ -8,6 +8,9 @@ class LoginSerializer(serializers.Serializer):
def validate(self, data):
user = authenticate(**data)
if user and user.is_active:
return user
raise serializers.ValidationError('Account is not activated.')
if not user:
raise serializers.ValidationError('Invalid Credentials.')
if not user.is_active:
raise serializers.ValidationError('Account is not activated.')
return user
name: django
channels:
- conda-forge
- defaults
dependencies:
- asgiref=3.5.*
- ca-certificates=2022.10.11
- certifi=2022.12.7
- cryptography=38.0.*
- django=4.1
- django-extensions=3.2.*
- djangorestframework=3.14.*
- freetype=2.12.*
- ncurses=6.3
- openssl
- pillow=9.3.*
- pip
- pycparser=2.21
- pyjwt=2.6.0
- python=3.9.15
- pytz=2022.7.1
- readline=8.2
- setuptools=65.6.*
- sqlite=3.40.*
- sqlparse=0.4.*
- tk=8.6.*
- tzdata
- wheel=0.37.*
- zlib=1.2.*
- zstd=1.5.*
- pip:
- django-countries==7.5
- django-rest-knox==4.2.0
- django-rest-passwordreset==1.3.0
- typing-extensions==4.4.0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment