@@ -1,11 +1,23 @@ | |||||
class UsersController < ApplicationController | class UsersController < ApplicationController | ||||
def login | |||||
end | |||||
def signup | def signup | ||||
if request.post? | |||||
# do user create logic | |||||
redirect_to root_url | |||||
end | |||||
end | |||||
def login | |||||
if request.post? | |||||
# do user login logic | |||||
redirect_to root_url | |||||
end | |||||
end | end | ||||
def create | |||||
render 'signup' | |||||
def logout | |||||
if request.post? | |||||
# do user logout logic | |||||
redirect_to root_url | |||||
end | |||||
end | end | ||||
end | end |
@@ -1,5 +1,5 @@ | |||||
<header> | <header> | ||||
<%= link_to({controller: 'tools', action: 'index'}, {id: 'home-link'}) do %> | |||||
<%= link_to(root_url, id: 'home-link') do %> | |||||
<%= corp_logo_tag %> | <%= corp_logo_tag %> | ||||
<span id="corp-name"> | <span id="corp-name"> | ||||
<%= AdminSetting.get('corp_name') %> | <%= AdminSetting.get('corp_name') %> | ||||
@@ -1,4 +1,11 @@ | |||||
<% provide(:title, 'Login') %> | <% provide(:title, 'Login') %> | ||||
<h1>Users#login</h1> | |||||
<p>Find me in app/views/users/login.html.erb</p> | |||||
<h1>Login</h1> | |||||
<%= form_tag do %> | |||||
<table> | |||||
<tr> | |||||
<td colspan="2"><%= submit_tag('Login') %></td> | |||||
</tr> | |||||
</table> | |||||
<% end %> |
@@ -0,0 +1,9 @@ | |||||
<% provide(:title, 'Logout') %> | |||||
<h1>Logout</h1> | |||||
<p>Are you sure you want to log out now?</p> | |||||
<%= form_tag do %> | |||||
<%= submit_tag('Log out') %></td> | |||||
<% end %> |
@@ -1,9 +1,12 @@ | |||||
Rails.application.routes.draw do | Rails.application.routes.draw do | ||||
root 'tools#index' | root 'tools#index' | ||||
get '/login' => 'users#login' | |||||
get '/signup' => 'users#signup' | get '/signup' => 'users#signup' | ||||
post '/signup' => 'users#create' | |||||
post '/signup' => 'users#signup' | |||||
get '/login' => 'users#login' | |||||
post '/login' => 'users#login' | |||||
get '/logout' => 'users#logout' | |||||
post '/logout' => 'users#logout' | |||||
get '/admin' => 'admin#index' | get '/admin' => 'admin#index' | ||||
post '/admin' => 'admin#update' | post '/admin' => 'admin#update' | ||||