From ab5c65d8306c817814774c135322cfc017bedabc Mon Sep 17 00:00:00 2001 From: cofiem Date: Fri, 13 Mar 2015 13:28:56 +1000 Subject: [PATCH] Made need to confirm (by chekcing email) more obvious. Closes #149 --- app/views/devise/registrations/edit.html.haml | 7 ------- app/views/layouts/application.html.haml | 8 ++++++++ app/views/public/index.html.haml | 7 ------- config/locales/devise.en.yml | 2 +- lib/modules/access/core.rb | 5 ++++- 5 files changed, 13 insertions(+), 16 deletions(-) diff --git a/app/views/devise/registrations/edit.html.haml b/app/views/devise/registrations/edit.html.haml index 94a86eda..4b957cc2 100644 --- a/app/views/devise/registrations/edit.html.haml +++ b/app/views/devise/registrations/edit.html.haml @@ -1,10 +1,3 @@ -- unless current_user.blank? - - if !current_user.confirmed? - .alert.fade.in.alert-warning - %button.close{ 'data-dismiss' => 'alert'} × - =t 'devise.failure.unconfirmed' - = link_to 'Resend confirmation email', new_user_confirmation_path - %h2 Edit #{resource_name.to_s.humanize} = simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { class: 'form-horizontal', :multipart => true, :method => :put }) do |f| diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 54e50e0f..1ce629f4 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -29,6 +29,14 @@ .span8 = render_breadcrumbs = bootstrap_flash + + - unless current_user.blank? + - if !current_user.confirmed? + .alert.fade.in.alert-warning + %button.close{ 'data-dismiss' => 'alert'} × + = t 'devise.failure.unconfirmed' + = link_to 'Resend confirmation email', new_user_confirmation_path + .row-fluid = yield .span2 diff --git a/app/views/public/index.html.haml b/app/views/public/index.html.haml index 9bde1267..be29b12e 100644 --- a/app/views/public/index.html.haml +++ b/app/views/public/index.html.haml @@ -1,10 +1,3 @@ -- unless current_user.blank? - - if !current_user.confirmed? - .alert.fade.in.alert-warning - %button.close{ 'data-dismiss' => 'alert'} × - =t 'devise.failure.unconfirmed' - = link_to 'Resend confirmation email', new_user_confirmation_path - %h1= Settings.organisation_names.site_long_name %p diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml index 6d04c528..8a2a13c0 100644 --- a/config/locales/devise.en.yml +++ b/config/locales/devise.en.yml @@ -15,7 +15,7 @@ en: not_found_in_database: "Invalid login or password." timeout: "Your session expired, please sign in again to continue." unauthenticated: "You need to sign in or sign up before continuing." - unconfirmed: "You have to confirm your account before continuing." + unconfirmed: "You have to confirm your account before continuing. Please check your email (including junk mail folder)." unauthorized: "You do not have sufficient permissions to access this page." mailer: confirmation_instructions: diff --git a/lib/modules/access/core.rb b/lib/modules/access/core.rb index 4950fec6..6f713372 100644 --- a/lib/modules/access/core.rb +++ b/lib/modules/access/core.rb @@ -258,7 +258,10 @@ def query_project_access(user, levels, query) end else is_guest = Access::Check.is_guest?(user) - fail ArgumentError, "User #{user.id} who is #{is_guest ? '' : 'not'} a guest with roles #{user.role_symbols.join(', ')} has no access." + Rails.logger.warn "User '#{user.user_name}' (#{user.id}) who is#{is_guest ? '' : ' not'} a guest with roles '#{user.role_symbols.join(', ')}' has no access." + + # any other role has no access (using .none to be chainable) + query.none end end