Sito marketing, SEO, legal, live programmata e branding Match Live Tv.
Logo e favicon nel header, partite programmate su web e mobile, reset password, pagine FAQ/sitemap, privacy/termini GDPR e icona Android «Match Live Tv». Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -7,7 +7,7 @@ module Api
|
||||
def index
|
||||
matches = @team.matches
|
||||
.includes(:team, :stream_sessions)
|
||||
.order(scheduled_at: :desc)
|
||||
.order(Arel.sql("scheduled_at ASC NULLS LAST"), created_at: :desc)
|
||||
render json: matches.map { |m| match_json(m) }
|
||||
end
|
||||
|
||||
|
||||
@@ -12,6 +12,15 @@ module Public
|
||||
.search_by_team_or_opponent(@query)
|
||||
.order(Arel.sql("started_at DESC NULLS LAST"), created_at: :desc)
|
||||
|
||||
busy_match_ids = StreamSession.where.not(status: %w[ended error]).select(:match_id)
|
||||
@upcoming_matches = Match
|
||||
.scheduled_upcoming
|
||||
.includes(:team)
|
||||
.search_teams_or_opponents(@query)
|
||||
.where.not(id: busy_match_ids)
|
||||
.order(scheduled_at: :asc)
|
||||
.limit(30)
|
||||
|
||||
@online_paths = Mediamtx::Client.new.online_path_names
|
||||
end
|
||||
|
||||
|
||||
@@ -15,5 +15,11 @@ module Public
|
||||
|
||||
def terms
|
||||
end
|
||||
|
||||
def faq
|
||||
end
|
||||
|
||||
def pallavolo
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
52
backend/app/controllers/public/password_resets_controller.rb
Normal file
52
backend/app/controllers/public/password_resets_controller.rb
Normal file
@@ -0,0 +1,52 @@
|
||||
module Public
|
||||
class PasswordResetsController < WebBaseController
|
||||
def new
|
||||
end
|
||||
|
||||
def create
|
||||
user = User.find_by(email: params[:email]&.downcase&.strip)
|
||||
if user
|
||||
token = user.generate_password_reset!
|
||||
UserMailer.password_reset(user, token).deliver_now
|
||||
end
|
||||
|
||||
redirect_to public_login_path,
|
||||
notice: "Se l'email è registrata, riceverai a breve un link per reimpostare la password."
|
||||
end
|
||||
|
||||
def edit
|
||||
@user = User.find_by_password_reset_token(params[:token])
|
||||
if @user.nil? || @user.password_reset_expired?
|
||||
redirect_to new_public_password_reset_path,
|
||||
alert: "Link non valido o scaduto. Richiedi un nuovo reset password."
|
||||
return
|
||||
end
|
||||
@token = params[:token]
|
||||
end
|
||||
|
||||
def update
|
||||
@user = User.find_by_password_reset_token(params[:token])
|
||||
if @user.nil? || @user.password_reset_expired?
|
||||
redirect_to new_public_password_reset_path,
|
||||
alert: "Link non valido o scaduto. Richiedi un nuovo reset password."
|
||||
return
|
||||
end
|
||||
|
||||
if params[:password].blank? || params[:password].length < 8
|
||||
flash.now[:alert] = "La password deve avere almeno 8 caratteri"
|
||||
@token = params[:token]
|
||||
return render :edit, status: :unprocessable_entity
|
||||
end
|
||||
|
||||
if params[:password] != params[:password_confirmation]
|
||||
flash.now[:alert] = "Le password non coincidono"
|
||||
@token = params[:token]
|
||||
return render :edit, status: :unprocessable_entity
|
||||
end
|
||||
|
||||
@user.update!(password: params[:password])
|
||||
@user.clear_password_reset!
|
||||
redirect_to public_login_path, notice: "Password aggiornata. Ora puoi accedere."
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -6,6 +6,12 @@ module Public
|
||||
end
|
||||
|
||||
def create
|
||||
unless params[:accept_terms] == "1"
|
||||
@user = User.new(user_params.merge(role: "coach"))
|
||||
flash.now[:alert] = "Devi accettare l’informativa privacy e i termini di servizio per registrarti."
|
||||
return render :new, status: :unprocessable_entity
|
||||
end
|
||||
|
||||
@user = User.new(user_params.merge(role: "coach"))
|
||||
if @user.save
|
||||
session[:user_id] = @user.id
|
||||
|
||||
@@ -2,6 +2,8 @@ module Public
|
||||
class SiteBaseController < ActionController::Base
|
||||
layout "marketing"
|
||||
|
||||
include ::SeoHelper
|
||||
include ::LegalHelper
|
||||
helper_method :current_user, :logged_in?
|
||||
|
||||
private
|
||||
|
||||
21
backend/app/controllers/public/sitemap_controller.rb
Normal file
21
backend/app/controllers/public/sitemap_controller.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
module Public
|
||||
class SitemapController < ActionController::Base
|
||||
def show
|
||||
base = MatchLiveTv.app_public_url.chomp("/")
|
||||
@entries = [
|
||||
{ loc: "#{base}/", changefreq: "weekly", priority: "1.0" },
|
||||
{ loc: "#{base}/funzionalita", changefreq: "monthly", priority: "0.9" },
|
||||
{ loc: "#{base}/prezzi", changefreq: "monthly", priority: "0.9" },
|
||||
{ loc: "#{base}/pallavolo-giovanile", changefreq: "monthly", priority: "0.85" },
|
||||
{ loc: "#{base}/faq", changefreq: "monthly", priority: "0.8" },
|
||||
{ loc: "#{base}/live", changefreq: "hourly", priority: "0.85" },
|
||||
{ loc: "#{base}/privacy", changefreq: "yearly", priority: "0.3" },
|
||||
{ loc: "#{base}/termini", changefreq: "yearly", priority: "0.3" }
|
||||
]
|
||||
|
||||
respond_to do |format|
|
||||
format.xml { render layout: false }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user