Skip to content

Commit

Permalink
Merge pull request #222 from pep-dortmund/fix_login
Browse files Browse the repository at this point in the history
increase size limit of password_hash
  • Loading branch information
maxnoe authored Jan 19, 2024
2 parents 0255de3 + b75c9d1 commit cd08a97
Show file tree
Hide file tree
Showing 6 changed files with 287 additions and 232 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
- name: Prepare postgres env
if: matrix.db == 'postgres'
run: |
sed < env-template -e 's/DATABASE_URL=.*$/DATABASE_URL=postgresql:\/\/pep:pep@localhost\/memberdb/' > .env
sed < env-template -e 's|DATABASE_URL=.*$|DATABASE_URL=postgresql://pep:pep@localhost/memberdb|' > .env
- name: "Perform migrations"
run: poetry run flask db upgrade
Expand All @@ -66,7 +66,9 @@ jobs:
grep 'No changes in schema detected.' migrate.log
- name: tests
run: poetry run python -m pytest --cov member_database --cov-report=xml
run: |
export USE_CONFIG_DB=1
poetry run python -m pytest --cov member_database --cov-report=xml
- uses: codecov/codecov-action@v1
if: matrix.db == 'postgres'
2 changes: 1 addition & 1 deletion member_database/authentication/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class User(UserMixin, db.Model):
id = db.Column(db.Integer, primary_key=True)

username = db.Column(db.String(64), index=True, unique=True)
password_hash = db.Column(db.String(128))
password_hash = db.Column(db.String(256))

person_id = db.Column(db.Integer, db.ForeignKey("person.id"), nullable=False)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
"""Increase length of password_hash field
Revision ID: 742e6adb504c
Revises: 0151da823114
Create Date: 2024-01-19 12:51:21.629225
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = "742e6adb504c"
down_revision = "0151da823114"
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table("user", schema=None) as batch_op:
batch_op.alter_column(
"password_hash",
existing_type=sa.VARCHAR(length=128),
type_=sa.String(length=256),
existing_nullable=True,
)

# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table("user", schema=None) as batch_op:
batch_op.alter_column(
"password_hash",
existing_type=sa.String(length=256),
type_=sa.VARCHAR(length=128),
existing_nullable=True,
)

# ### end Alembic commands ###
Loading

0 comments on commit cd08a97

Please sign in to comment.