Add home page

This commit is contained in:
Trevor Vallender 2023-08-20 12:49:21 +01:00
parent b246c5ac70
commit 2a44d71478
4 changed files with 9 additions and 2 deletions

View File

@ -0,0 +1,5 @@
# frozen_string_literal: true
class HomePagesController < ApplicationController
def index; end
end

View File

@ -11,7 +11,7 @@ class SessionsController < ApplicationController
def create def create
if @user.present? && @user.authenticate(params[:password]) if @user.present? && @user.authenticate(params[:password])
session[:user_id] = @user.id session[:user_id] = @user.id
redirect_to @user, notice: t(".logged_in") redirect_to root_path, notice: t(".logged_in")
else else
flash.now.alert = t(".login_fail") flash.now.alert = t(".login_fail")
render :new, status: :unprocessable_entity render :new, status: :unprocessable_entity

View File

@ -0,0 +1 @@
<h2>Hello, <%= current_user.full_name %></h2>

View File

@ -3,8 +3,9 @@
Rails.application.routes.draw do Rails.application.routes.draw do
default_url_options :host => "summonplayer.com" default_url_options :host => "summonplayer.com"
root "sessions#new" root "home_pages#index"
# Users and sessions
resources :users, only: [:new, :create, :show, :edit, :update] resources :users, only: [:new, :create, :show, :edit, :update]
resources :sessions, only: [:new, :create] resources :sessions, only: [:new, :create]
delete "log_out", to: "sessions#destroy_session" delete "log_out", to: "sessions#destroy_session"