Commit 5bb1eaeb by Tan Phat Nguyen

login OK

parent e97d813a
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery //= require jquery
//= require jquery_ujs //= require jquery_ujs
//= require bootstrap
//= require turbolinks //= require turbolinks
//= require_tree . //= require_tree .
...@@ -2,4 +2,5 @@ class ApplicationController < ActionController::Base ...@@ -2,4 +2,5 @@ class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception. # Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead. # For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception protect_from_forgery with: :exception
include SessionsHelper
end end
...@@ -5,8 +5,23 @@ ...@@ -5,8 +5,23 @@
<ul class="nav navbar-nav pull-right"> <ul class="nav navbar-nav pull-right">
<li><%= link_to "Home", root_path %></li> <li><%= link_to "Home", root_path %></li>
<li><%= link_to "Help", help_path %></li> <li><%= link_to "Help", help_path %></li>
<li><%= link_to "Log in", '#' %></li> <% if logged_in? %>
<li><%= link_to "Users", "#" %></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Account <b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li><%= link_to "Profile", current_user %></li>
<li><%= link_to "Settings", "#" %></li>
<li class="divider"></li>
<li><%= link_to "Log out", logout_path, method: "delete" %></li>
</ul>
</li>
<% else %>
<li><%= link_to "Log in", login_path %></li>
<% end %>
</ul> </ul>
</nav> </nav>
</div> </div>
</header> </header>
\ No newline at end of file
Rails.application.routes.draw do Rails.application.routes.draw do
get 'sessions/new'
get 'users/new' get 'users/new'
root 'static_pages#home' root 'static_pages#home'
get 'help' => 'static_pages#help' get 'help' => 'static_pages#help'
get 'about' => 'static_pages#about' get 'about' => 'static_pages#about'
get 'contact' => 'static_pages#contact' get 'contact' => 'static_pages#contact'
get 'signup' => 'users#new' get 'signup' => 'users#new'
get 'login' => 'sessions#new'
post 'login' => 'sessions#create'
delete 'logout' => 'sessions#destroy'
resources :users resources :users
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment