Initial commit: monorepo Match Live TV.
Rails API, app Flutter, infrastruttura Docker/MediaMTX, sito marketing e documentazione di deploy. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
24
backend/app/controllers/public/sessions_controller.rb
Normal file
24
backend/app/controllers/public/sessions_controller.rb
Normal file
@@ -0,0 +1,24 @@
|
||||
module Public
|
||||
class SessionsController < WebBaseController
|
||||
def new
|
||||
redirect_to public_team_dashboard_path(current_user.teams.first) if logged_in? && current_user.teams.any?
|
||||
end
|
||||
|
||||
def create
|
||||
user = User.find_by(email: params[:email]&.downcase)
|
||||
if user&.authenticate(params[:password])
|
||||
session[:user_id] = user.id
|
||||
dest = user.teams.first ? public_team_dashboard_path(user.teams.first) : new_public_team_path
|
||||
redirect_to dest, notice: "Bentornato!"
|
||||
else
|
||||
flash.now[:alert] = "Email o password non validi"
|
||||
render :new, status: :unauthorized
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
reset_session
|
||||
redirect_to public_pricing_path, notice: "Disconnesso"
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user