From 12102baa7d1c875c6ffd1d2941085c9679bd435d Mon Sep 17 00:00:00 2001 From: Joachim Filip Ignacy Bartosik Date: Thu, 5 Aug 2010 19:37:10 +0200 Subject: If user is invalid only thing [s]he can do is editing his/her account. --- app/controllers/application_controller.rb | 10 ++++++++++ app/controllers/users_controller.rb | 1 + app/models/guest.rb | 1 + app/views/users/edit.dryml | 9 +++++++++ 4 files changed, 21 insertions(+) create mode 100644 app/views/users/edit.dryml (limited to 'app') diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 6635a3f..d1623af 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -5,6 +5,16 @@ class ApplicationController < ActionController::Base helper :all # include all helpers, all the time protect_from_forgery # See ActionController::RequestForgeryProtection for details + append_before_filter :only_valid_users + # Scrub sensitive parameters from your log # filter_parameter_logging :password + + protected + def only_valid_users + unless current_user.valid? + flash[:notice] = "You user account is invalid, please fix problems before you continue." + redirect_to edit_user_path(current_user) + end + end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 18642a0..d4d7644 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -3,6 +3,7 @@ class UsersController < ApplicationController hobo_user_controller openid_login:openid_opts => { :model => User } + skip_before_filter :only_valid_users, :only => [:edit, :update] auto_actions :all, :except => [ :index, :new, :create ] index_action :ready_recruits index_action :mentorless_recruits diff --git a/app/models/guest.rb b/app/models/guest.rb index 904dfe1..2e6a677 100644 --- a/app/models/guest.rb +++ b/app/models/guest.rb @@ -10,4 +10,5 @@ class Guest < Hobo::Guest def questions_to_approve; []; end def role; Role.new(:guest); end def token; nil; end + def valid?; true; end end diff --git a/app/views/users/edit.dryml b/app/views/users/edit.dryml new file mode 100644 index 0000000..f974b53 --- /dev/null +++ b/app/views/users/edit.dryml @@ -0,0 +1,9 @@ + + + + +

Please set data for your account.

+
+ + + -- cgit v1.2.3-65-gdbad