logger.debug "No token received, session is #{session.inspect}"
end
if try_redirect_to_login
- respond_to do |f|
- f.html {
- if request.method == 'GET'
- if login_optional
- Thread.current[:arvados_api_token] = nil
- yield
- else
+ unless login_optional
+ respond_to do |f|
+ f.html {
+ if request.method == 'GET'
redirect_to $arvados_api_client.arvados_login_url(return_to: request.url)
+ else
+ flash[:error] = "Either you are not logged in, or your session has timed out. I can't automatically log you in and re-attempt this request."
+ redirect_to :back
end
- else
- flash[:error] = "Either you are not logged in, or your session has timed out. I can't automatically log you in and re-attempt this request."
- redirect_to :back
- end
- }
- f.json {
- @errors = ['You do not seem to be logged in. You did not supply an API token with this request, and your session (if any) has timed out.']
- self.render_error status: 422
- }
+ }
+ f.json {
+ @errors = ['You do not seem to be logged in. You did not supply an API token with this request, and your session (if any) has timed out.']
+ self.render_error status: 422
+ }
+ end
+ else
+ # login is optional for this route so go on to the regular controller
+ Thread.current[:arvados_api_token] = nil
+ yield
end
end
ensure
</div>
</div>
</div>
-<% else %>
-<h1>Welcome to Arvados, <%= current_user.first_name %></h1>
-<div class="row-fluid">
-<div class="col">
- <h4>Your account status</h4>
-<div class="well clearfix">
- <p><strong>New / inactive</strong></p>
- <p>
- Your account must be activated by an Arvados administrator. If this
- is your first time accessing Arvados and would like to request
- access, or you believe you are seeing the page in error, please
-<%= link_to "contact us", Rails.configuration.activation_contact_link %>. You should receive an email at the address you used to log in when
- your account is activated. In the mean time, you can <%= link_to "learn more about Arvados", "https://arvados.org/projects/arvados/wiki/Introduction_to_Arvados" %>,
- and <%= link_to "read the Arvados user guide", "http://doc.arvados.org/user" %>.
-</p>
- <p>
- <%= link_to raw('Contact us ✉'),
- Rails.configuration.activation_contact_link, class: "pull-right btn btn-primary" %></p>
-</div>
-</div>
-</div>
+<% elsif current_user %>
+ <%= image_tag "dax.png", style: "float: right; max-width: 25%; margin-left: 2em" %>
+ <h1>Welcome to Arvados, <%= current_user.first_name %>!</h1>
+ <div class="row-fluid">
+ <div class="col span8">
+ <h4>Your account status</h4>
+ <div class="well clearfix">
+ <p><strong>New / inactive</strong></p>
+ <p>
+ Your account must be activated by an Arvados administrator. If this
+ is your first time accessing Arvados and would like to request
+ access, or you believe you are seeing the page in error, please
+ <%= link_to "contact us", Rails.configuration.activation_contact_link %>.
+ You should receive an email at the address you used to log in when
+ your account is activated. In the mean time, you can
+ <%= link_to "learn more about Arvados", "https://arvados.org/projects/arvados/wiki/Introduction_to_Arvados" %>,
+ and <%= link_to "read the Arvados user guide", "http://doc.arvados.org/user" %>.
+ </p>
+ <p>
+ <%= link_to raw('Contact us ✉'),
+ Rails.configuration.activation_contact_link, class: "pull-right btn btn-primary" %></p>
+ </div>
+ </div>
+ </div>
<% end %>
-<h1>Please log in to use Arvados Workbench.</h1>
-</p>
-<p style="margin-top: 1em">
-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 the Arvados Workbench. If you have never used Arvados before, logging in for the first time will also create a new user account. Arvados uses Google services for only for identification, and will never access any personal information.
-</p>
-<p style="margin-top: 1em">
- <a class="btn btn-primary" href="<%= $arvados_api_client.arvados_login_url(return_to: request.url) %>">Click here to log in to Arvados Workbench with a Google account</a>
-</p>
+<%= image_tag "dax.png", style: "float: right; max-width: 25%; margin-left: 2em" %>
+<h1>Hi there! Please log in to use Arvados Workbench.</h1>
+<div class="row-fluid">
+ <div class="col span8" 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 the Arvados
+ Workbench. If you have never used Arvados before, logging in for the first
+ time will also create a new user account. Arvados uses your your name and
+ email address from Google services only for identification, and will never
+ access any personal information.</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 Arvados Workbench with a Google account</a>
+ </p>
+ </div>
+ </div>
+</div>
+