end
def thread_with_mandatory_api_token
- thread_with_api_token do
- yield
+ thread_with_api_token(true) do
+ if Thread.current[:arvados_api_token]
+ yield
+ else
+ render 'users/welcome'
+ end
end
end
end
def check_user_agreements
- if current_user && !current_user.is_active && current_user.is_invited
+ if current_user && !current_user.is_active
+ if not current_user.is_invited
+ return render 'users/inactive'
+ end
signatures = UserAgreement.signatures
@signed_ua_uuids = UserAgreement.signatures.map &:head_uuid
@required_user_agreements = UserAgreement.all.map do |ua|
class UsersController < ApplicationController
skip_before_filter :find_object_by_uuid, :only => [:welcome, :activity, :storage]
- skip_around_filter :thread_with_mandatory_api_token, :only => :welcome
before_filter :ensure_current_user_is_admin, only: [:sudo, :unsetup, :setup]
def welcome
--- /dev/null
+<% content_for :breadcrumbs do raw '<!-- -->' end %>
+
+<div class="row">
+ <div class="col-sm-8 col-sm-push-4" style="margin-top: 1em">
+ <div class="well clearfix">
+ <%= image_tag "dax.png", style: "width: 147px; height: 197px; max-width: 25%; margin-right: 2em", class: 'pull-left' %>
+
+ <h3>Hi! You're logged in, but...</h3>
+
+ <p>
+
+ Your account is inactive.
+
+ </p><p>
+
+ An administrator must activate your account before you can get
+ any further.
+
+ </p>
+ </div>
+ </div>
+</div>
<% content_for :breadcrumbs do raw '<!-- -->' end %>
-<%= image_tag "dax.png", style: "float: left; max-width: 25%; margin-right: 2em" %>
-<h1>Hi there! Please log in to use <%= Rails.configuration.site_name %>.</h1>
-<div class="row-fluid">
- <div class="col span8" style="margin-top: 1em">
+<div class="row">
+ <div class="col-sm-8 col-sm-push-4" style="margin-top: 1em">
<div class="well clearfix">
- <p>When you click on the button below you will be taken to a Google sign-in page.
- After entering your information, you will be redirected back to <%= Rails.configuration.site_name %>
- If you have never used <%= Rails.configuration.site_name %> before, logging in for the first
- time will also create a new user account. <%= Rails.configuration.site_name %> uses your name and
- email address from Google services only for identification, and can not access any personal information
- beyond that.
- </p>
+ <%= image_tag "dax.png", style: "width: 147px; height: 197px; max-width: 25%; margin-right: 2em", class: 'pull-left' %>
+
+ <h3>Please log in.</h3>
+
+ <p>
+
+ The "Log in" button below will show you a Google sign-in page.
+ After you assure Google that you want to log in here with your
+ Google account, you will be redirected back here to
+ <%= Rails.configuration.site_name %>.
+
+ </p><p>
+
+ If you have never used <%= Rails.configuration.site_name %>
+ before, logging in for the first time will automatically
+ create a new account.
+
+ </p><p>
+
+ <i><%= Rails.configuration.site_name %> uses your name and
+ email address only for identification, and does not retrieve
+ any other personal information from Google.</i>
+
+ </p>
<p>
- <a class="pull-right btn btn-primary" href="<%= arvados_api_client.arvados_login_url(return_to: request.url) %>">
- Click here to log in to <%= Rails.configuration.site_name %> with a Google account</a>
+ <%= link_to arvados_api_client.arvados_login_url(return_to: request.url), class: "pull-right btn btn-primary" do %>
+ Log in to <%= Rails.configuration.site_name %>
+ <i class="fa fa-fw fa-arrow-circle-right"></i>
+ <% end %>
</p>
</div>
</div>
</div>
-
-
require 'test_helper'
class FoldersControllerTest < ActionController::TestCase
- # test "the truth" do
- # assert true
- # end
+ test "inactive user is asked to sign user agreements on front page" do
+ get :index, {}, session_for(:inactive)
+ assert_response :success
+ assert_not_empty assigns(:required_user_agreements),
+ "Inactive user did not have required_user_agreements"
+ assert_template 'user_agreements/index',
+ "Inactive user was not presented with a user agreement at the front page"
+ end
end