diff options
author | Joachim Filip Ignacy Bartosik <jbartosik@gmail.com> | 2010-08-05 19:37:10 +0200 |
---|---|---|
committer | Joachim Filip Ignacy Bartosik <jbartosik@gmail.com> | 2010-08-11 20:03:02 +0200 |
commit | 12102baa7d1c875c6ffd1d2941085c9679bd435d (patch) | |
tree | 5bbe831e98f53aed19e669950fcf486fe50f717d /app | |
parent | Alternative login with openID (diff) | |
download | recruiting-webapp-12102baa7d1c875c6ffd1d2941085c9679bd435d.tar.gz recruiting-webapp-12102baa7d1c875c6ffd1d2941085c9679bd435d.tar.bz2 recruiting-webapp-12102baa7d1c875c6ffd1d2941085c9679bd435d.zip |
If user is invalid only thing [s]he can do is editing his/her account.
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/application_controller.rb | 10 | ||||
-rw-r--r-- | app/controllers/users_controller.rb | 1 | ||||
-rw-r--r-- | app/models/guest.rb | 1 | ||||
-rw-r--r-- | app/views/users/edit.dryml | 9 |
4 files changed, 21 insertions, 0 deletions
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 @@ +<edit-page if="¤t_user.valid?" /> +<else> + <edit-page> + <body:> + <h1>Please set data for your account.</h1> + <form/> + </body:> + </edit-page> +</else> |