Adding argon2 hashing to user model
	
		
			
	
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is failing
				
					Details
				
			
		
	
				
					
				
			
				
	
				continuous-integration/drone/push Build is failing
				
					Details
				
			
		
	
							parent
							
								
									af854f448b
								
							
						
					
					
						commit
						910ad0aedf
					
				@ -1,15 +1,26 @@
 | 
				
			|||||||
from flask import Flask
 | 
					from flask import Flask
 | 
				
			||||||
 | 
					from flask_login import LoginManager
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from .config import ContactSettings
 | 
					from .config import ContactSettings
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Configure Authentication
 | 
				
			||||||
 | 
					login_manager = LoginManager()
 | 
				
			||||||
 | 
					login_manager.session_protection = "strong"
 | 
				
			||||||
 | 
					login_manager.login_view = "user.user_login"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def create_app(config: ContactSettings = None):
 | 
					def create_app(config: ContactSettings = None):
 | 
				
			||||||
    app = Flask("htmx_contact")
 | 
					    app = Flask("htmx_contact")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    app.config.from_object(config if config else ContactSettings())
 | 
					    app.config.from_object(config if config else ContactSettings())
 | 
				
			||||||
 | 
					    login_manager.init_app(app)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    from . import main
 | 
					    from . import main
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    app.register_blueprint(main.bp)
 | 
					    app.register_blueprint(main.bp)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    from . import user
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    app.register_blueprint(user.bp)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return app
 | 
					    return app
 | 
				
			||||||
 | 
				
			|||||||
@ -0,0 +1,18 @@
 | 
				
			|||||||
 | 
					from flask import Blueprint
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bp = Blueprint("user", __name__, url_prefix="/user")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@bp.route("/login", methods=["GET", "POST"])
 | 
				
			||||||
 | 
					def user_login():
 | 
				
			||||||
 | 
					    pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@bp.route("/logout", methods=["GET"])
 | 
				
			||||||
 | 
					def user_logout():
 | 
				
			||||||
 | 
					    pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@bp.route("/sign-up")
 | 
				
			||||||
 | 
					def user_sign_up():
 | 
				
			||||||
 | 
					    pass
 | 
				
			||||||
@ -0,0 +1,30 @@
 | 
				
			|||||||
 | 
					"""empty message
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Revision ID: f06a2e34836b
 | 
				
			||||||
 | 
					Revises: d76ecaeb13db
 | 
				
			||||||
 | 
					Create Date: 2023-09-23 07:58:10.338559
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					"""
 | 
				
			||||||
 | 
					from typing import Sequence, Union
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					from alembic import op
 | 
				
			||||||
 | 
					import sqlalchemy as sa
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# revision identifiers, used by Alembic.
 | 
				
			||||||
 | 
					revision: str = 'f06a2e34836b'
 | 
				
			||||||
 | 
					down_revision: Union[str, None] = 'd76ecaeb13db'
 | 
				
			||||||
 | 
					branch_labels: Union[str, Sequence[str], None] = None
 | 
				
			||||||
 | 
					depends_on: Union[str, Sequence[str], None] = None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def upgrade() -> None:
 | 
				
			||||||
 | 
					    # ### commands auto generated by Alembic - please adjust! ###
 | 
				
			||||||
 | 
					    op.add_column('user', sa.Column('password_hash', sa.String(), nullable=False))
 | 
				
			||||||
 | 
					    # ### end Alembic commands ###
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def downgrade() -> None:
 | 
				
			||||||
 | 
					    # ### commands auto generated by Alembic - please adjust! ###
 | 
				
			||||||
 | 
					    op.drop_column('user', 'password_hash')
 | 
				
			||||||
 | 
					    # ### end Alembic commands ###
 | 
				
			||||||
					Loading…
					
					
				
		Reference in New Issue