- Remove unnecessary turbo frame tag from the signup form - Directly render the form within the column div This change simplifies the user signup view by removing the unneeded turbo frame, which was not contributing to the functionality. The form is now rendered directly, making the code cleaner and easier to understand.
27 lines
675 B
Ruby
27 lines
675 B
Ruby
class SessionsController < ApplicationController
|
|
include SessionsHelper
|
|
def new
|
|
|
|
end
|
|
|
|
def create
|
|
user = User.find_by(email: params[:session][:email].downcase)
|
|
# if user && user.authenticate(params[:session][:password])
|
|
if user&.authenticate(params[:session][:password])
|
|
forwarding_url = session[:forwarding_url]
|
|
reset_session
|
|
params[:session][:remember_me] == "1" ? remember(user) : forget(user)
|
|
log_in user
|
|
redirect_to forwarding_url || user
|
|
else
|
|
flash.now[:danger] = "Invalid email/password combination"
|
|
render "new"
|
|
end
|
|
end
|
|
|
|
def destroy
|
|
log_out if logged_in?
|
|
redirect_to root_url
|
|
end
|
|
end
|