Skip to content
This repository has been archived by the owner on Feb 18, 2020. It is now read-only.

Commit

Permalink
use write_secure_token() to store authentication token
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob McKinnon committed Jan 22, 2014
1 parent edc1fde commit c8d3e1f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
GIT
remote: git://github.com/ministryofjustice/author.git
revision: 1b944e6bd5379712ce8c0dd58b3cd4a4d4af23d1
revision: 2d8113059a3f9dea9f03a2bcf1ce89d9e3158191
branch: controller_mixin
specs:
author (1.2)
Expand Down
7 changes: 4 additions & 3 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ def login_screen

def create_session
author = Author::Proxy.new(Rails.application.config.auth_client)

begin
if(author.login(params[:email], params[:password]))
session[:secret_token] = author.session
write_secure_token author.session
else
flash_alert "Authentication failed."
end
Expand All @@ -21,6 +22,6 @@ def create_session

def logout
reset_session
redirect_to controller: 'users', action: 'login_screen'
redirect_to controller: 'users', action: 'login_screen'
end
end
end

0 comments on commit c8d3e1f

Please sign in to comment.