Skip to content

Commit

Permalink
Fixed flash message logic and behavior (#1117)
Browse files Browse the repository at this point in the history
  • Loading branch information
kelynch authored Dec 11, 2024
1 parent 9ff4c6e commit 842896e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/assets/stylesheets/_header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#header {
padding: 0px;
background-color: $black;
margin-bottom: 1em;

.navbar-brand {
color: $white;
Expand Down
1 change: 0 additions & 1 deletion app/controllers/users/omniauth_callbacks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ def cas
flash.alert = "You are not a recognized CAS user."
else
sign_in_and_redirect @user, event: :authentication # this will throw if @user is not activated
flash.notice = "Welcome, #{@user.given_name}"
end
end
end
4 changes: 4 additions & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,12 @@
<% if flash[:notice] or flash[:alert] %>
<div class="row">
<div class="col">
<% if flash[:notice]%>
<div class="alert alert-primary" role="alert" ><%= flash[:notice] %></div>
<% end %>
<% if flash[:alert]%>
<div class="alert alert-warning" role="alert"><%= flash[:alert] %></div>
<% end %>
</div>
</div>
<% end %>
Expand Down
1 change: 0 additions & 1 deletion spec/controllers/omniauth_callbacks_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
allow(User).to receive(:from_cas) { project_sponsor }
get :cas
expect(response).to redirect_to(root_path)
expect(flash.notice).to eq("Welcome, #{project_sponsor.given_name}")
end
end

Expand Down

0 comments on commit 842896e

Please sign in to comment.