diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index f0f5454..eba7470 100755 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -13,7 +13,8 @@ class ApplicationController < ActionController::Base end def authenticated - redirect_to root_url and reset_session if not current_user + path = request.fullpath.present? ? root_url(:url => request.fullpath) : root_url + redirect_to path and reset_session if not current_user end def is_admin? diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index b803b8e..3f84173 100755 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -4,28 +4,29 @@ class SessionsController < ApplicationController skip_before_filter :authenticated, :only => [:new, :create] def new - redirect_to home_dashboard_index_path if current_user + @url = params[:url] + redirect_to home_dashboard_index_path if current_user end def create - + path = params[:url].present? ? params[:url] : home_dashboard_index_path begin # Normalize the email address, why not user = User.authenticate(params[:email].to_s.downcase, params[:password]) + # @url = params[:url] rescue Exception => e end if user session[:user_id] = user.user_id if User.where(:user_id => user.user_id).exists? - redirect_to home_dashboard_index_path + redirect_to path else # Removed this code, just doesn't seem specific enough! # flash[:error] = "Either your username and password is incorrect" flash[:error] = e.message render "new" - end - + end end def destroy diff --git a/app/models/work_info.rb b/app/models/work_info.rb index 4a564e0..c3b70b6 100644 --- a/app/models/work_info.rb +++ b/app/models/work_info.rb @@ -1,10 +1,17 @@ class WorkInfo < ActiveRecord::Base attr_accessible :DoB, :SSN, :bonuses, :income, :years_worked belongs_to :user + #before_save :encrypt_ssn # We should probably use this def last_four "***-**-" << self.SSN[-4,4] end + def encrypt_ssn + end + + def decrypt_ssn + end + end diff --git a/app/views/layouts/tutorial/crypto/_ssn.html.erb b/app/views/layouts/tutorial/crypto/_ssn.html.erb new file mode 100644 index 0000000..725d54f --- /dev/null +++ b/app/views/layouts/tutorial/crypto/_ssn.html.erb @@ -0,0 +1,101 @@ +
\ No newline at end of file diff --git a/app/views/sessions/new.html.erb b/app/views/sessions/new.html.erb index 0b3b7d3..481763a 100755 --- a/app/views/sessions/new.html.erb +++ b/app/views/sessions/new.html.erb @@ -13,6 +13,7 @@