This repository has been archived by the owner on Mar 9, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,18 @@ | ||
class SessionsController < ApplicationController | ||
|
||
def create | ||
user = login(params[:email], params[:password], params[:remember_me]) | ||
if user | ||
redirect_back_or_to root_url, :notice => "Logged in!" | ||
else | ||
flash.now.alert = "Email or password was invalid" | ||
render :new | ||
end | ||
end | ||
|
||
def destroy | ||
logout | ||
redirect_to root_url, :notice => "Logged out!" | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<%= form_tag sessions_path do %> | ||
<div class="field"> | ||
<%= label_tag :email %> | ||
<%= text_field_tag :email, params[:email] %> | ||
</div> | ||
<div class="field"> | ||
<%= label_tag :password %> | ||
<%= password_field_tag :password %> | ||
</div> | ||
<div class="field"> | ||
<%= check_box_tag :remember_me, 1, params[:remember_me] %> | ||
<%= label_tag :remember_me %> | ||
</div> | ||
<div class="actions"><%= submit_tag "Log in" %></div> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters