Skip to content

Commit

Permalink
Fix saving password without hashing it
Browse files Browse the repository at this point in the history
  • Loading branch information
marifergun committed Nov 22, 2023
1 parent ff54cd5 commit 63785b5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 18 deletions.
27 changes: 12 additions & 15 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,20 @@ on:
branches:
- dev
workflow_dispatch:

jobs:
run_pull:
name: run pull
runs-on: ubuntu-latest

steps:
- name: install ssh keys
# check this thread to understand why its needed:
# https://stackoverflow.com/a/70447517
run: |
install -m 600 -D /dev/null ~/.ssh/id_rsa
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
ssh-keyscan -H ${{ secrets.SSH_HOST }} > ~/.ssh/known_hosts
- name: connect and pull
run: |
ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}
"cd ${{ secrets.WORK_DIR }} && git checkout ${{ secrets.MAIN_BRANCH }} && \
git pull && docker compose up -d --build && \
docker compose exec web bash -l -c "python manage.py makemigrations && python manage.py migrate""
- name: install ssh keys
# check this thread to understand why its needed:
# https://stackoverflow.com/a/70447517
run: |
install -m 600 -D /dev/null ~/.ssh/id_rsa
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
ssh-keyscan -H ${{ secrets.SSH_HOST }} > ~/.ssh/known_hosts
- name: connect and pull
run: ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "cd ${{ secrets.WORK_DIR }} && git checkout ${{ secrets.MAIN_BRANCH }} && git pull && exit"

3 changes: 2 additions & 1 deletion cosapweb/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ def create(self, data):
first_name=data["first_name"],
last_name=data["last_name"],
email=data["email"],
password=data["password"],
)
user.set_password(data["password"])
user.save()

return user

Expand Down
4 changes: 2 additions & 2 deletions cosapweb/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@

MEDIA_ROOT = os.environ.get("COSAP_API_DATA", os.path.join(BASE_DIR, "data"))

DJANGO_DRF_FILEPOND_UPLOAD_TMP = os.path.join(MEDIA_ROOT, "filepond_temp_files")
DJANGO_DRF_FILEPOND_FILE_STORE_PATH = MEDIA_ROOT
DJANGO_DRF_FILEPOND_UPLOAD_TMP = os.path.join(BASE_DIR, "filepond_temp_files")
DJANGO_DRF_FILEPOND_FILE_STORE_PATH = BASE_DIR

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.0/howto/static-files/
Expand Down

0 comments on commit 63785b5

Please sign in to comment.