diff --git a/LyricsPy/K8S/lyrics-deployment.yaml b/LyricsPy/K8S/lyrics-deployment.yaml index f1800b6..e39831f 100644 --- a/LyricsPy/K8S/lyrics-deployment.yaml +++ b/LyricsPy/K8S/lyrics-deployment.yaml @@ -36,7 +36,7 @@ spec: - --bind - 0.0.0.0:5000 - lyrics:create_app() - image: creylopez/lyrics:4.0 + image: creylopez/lyrics:5.0 name: lyrics ports: - containerPort: 5000 diff --git a/LyricsPy/servicios/creaImagen.sh b/LyricsPy/servicios/creaImagen.sh index 997af28..a50c2a2 100644 --- a/LyricsPy/servicios/creaImagen.sh +++ b/LyricsPy/servicios/creaImagen.sh @@ -1,3 +1,3 @@ -docker build --no-cache -t creylopez/lyrics:4.0 . -docker push creylopez/lyrics:4.0 +docker build --no-cache -t creylopez/lyrics:5.0 . +docker push creylopez/lyrics:5.0 diff --git a/LyricsPy/servicios/instance/songs.db b/LyricsPy/servicios/instance/songs.db index 669ec3f..dd49ec5 100644 Binary files a/LyricsPy/servicios/instance/songs.db and b/LyricsPy/servicios/instance/songs.db differ diff --git a/LyricsPy/servicios/lyrics/auth.py b/LyricsPy/servicios/lyrics/auth.py index 8d45151..c586d5f 100644 --- a/LyricsPy/servicios/lyrics/auth.py +++ b/LyricsPy/servicios/lyrics/auth.py @@ -13,11 +13,11 @@ def login(): @bp.route('/login', methods=['POST']) def login_post(): - email = request.form.get('email') + username = request.form.get('username') password = request.form.get('password') remember = True if request.form.get('remember') else False - user = User.query.filter_by(email=email).first() + user = User.query.filter_by(username=username).first() # check if the user actually exists # take the user-supplied password, hash it, and compare it to the hashed password in the database @@ -28,7 +28,7 @@ def login_post(): # if the above check passes, then we know the user has the right credentials login_user(user, remember=remember) - return redirect(url_for('reservas.misreservas')) + return redirect(url_for('paginas.index')) @bp.route('/signup') def signup(): @@ -36,18 +36,17 @@ def signup(): @bp.route('/signup', methods=['POST']) def signup_post(): - email = request.form.get('email') - name = request.form.get('name') + username = request.form.get('username') password = request.form.get('password') - user = User.query.filter_by(email=email).first() # if this returns a user, then the email already exists in database + user = User.query.filter_by(username=username).first() # if this returns a user, then the user already exists in database if user: # if a user is found, we want to redirect back to signup page so user can try again flash('La dirección de correo ya existe') return redirect(url_for('auth.signup')) # create a new user with the form data. Hash the password so the plaintext version isn't saved. - new_user = User(email=email, name=name, password=generate_password_hash(password, method='pbkdf2:sha256')) + new_user = User(username=username, password=generate_password_hash(password, method='pbkdf2:sha256')) # add the new user to the database db.session.add(new_user) @@ -59,4 +58,4 @@ def signup_post(): @login_required def logout(): logout_user() - return redirect(url_for('auth.index')) + return redirect(url_for('paginas.index')) diff --git a/LyricsPy/servicios/lyrics/models.py b/LyricsPy/servicios/lyrics/models.py index ad139d5..5c87631 100644 --- a/LyricsPy/servicios/lyrics/models.py +++ b/LyricsPy/servicios/lyrics/models.py @@ -1,7 +1,7 @@ from flask_sqlalchemy import SQLAlchemy from flask_login import UserMixin -db = SQLAlchemy() +from . import db class User(UserMixin, db.Model): id = db.Column(db.Integer, primary_key=True) diff --git a/LyricsPy/servicios/lyrics/paginas.py b/LyricsPy/servicios/lyrics/paginas.py index 5059070..db00d63 100644 --- a/LyricsPy/servicios/lyrics/paginas.py +++ b/LyricsPy/servicios/lyrics/paginas.py @@ -79,15 +79,6 @@ def album(album_id): songs = Song.query.filter_by(album_id=album_id).all() return render_template('album.html', album=album, songs=songs) -@bp.route('/search') -def search(): - query = request.args.get('query', '') - if query: - songs = Song.query.filter(Song.title.contains(query)).all() - else: - songs = [] - return render_template('search.html', query=query, songs=songs) - @bp.route('/uploads/') @login_required def uploaded_file(filename): diff --git a/LyricsPy/servicios/lyrics/templates/_navegacion.html b/LyricsPy/servicios/lyrics/templates/_navegacion.html index e32a2fd..607b282 100644 --- a/LyricsPy/servicios/lyrics/templates/_navegacion.html +++ b/LyricsPy/servicios/lyrics/templates/_navegacion.html @@ -23,13 +23,16 @@