Skip to content

Commit

Permalink
clear alert session variable on logout #4842
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew-a-dunlap committed Oct 12, 2018
1 parent a7cf5d8 commit a29a8fc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ private TreeNode getDataverseNode(Dataverse dataverse, TreeNode root, boolean ex
*/
public String logout() {
dataverseSession.setUser(null);
dataverseSession.setStatusDismissed(false);

String redirectPage = navigationWrapper.getPageFromContext();
try {
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/edu/harvard/iq/dataverse/DataverseSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
@SessionScoped
public class DataverseSession implements Serializable{

/* Note that on logout, variables must be cleared manually in DataverseHeaderFragment*/
private User user;

@EJB
Expand Down Expand Up @@ -52,8 +53,8 @@ public boolean isStatusDismissed() {
return statusDismissed;
}

public void dismissStatus() {
statusDismissed = true; //MAD: Set to true to enable code!
public void setStatusDismissed(boolean status) {
statusDismissed = status; //MAD: Set to true to enable code!
}

public StaticPermissionQuery on( Dataverse d ) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/dataverse_header.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
<o:form class="form-inline">
<div id="status-alert" class="bg-warning" jsf:rendered="#{!empty settingsWrapper.get(':StatusMessageText') and !empty settingsWrapper.get(':StatusMessageHeader') and !dataverseSession.isStatusDismissed()}">
<div class="alert alert-dismissible container text-warning">
<p:commandButton class="close" id="closeButton" actionListener="#{dataverseSession.dismissStatus()}" update="@form" value="&#215;" />
<p:commandButton class="close" id="closeButton" actionListener="#{dataverseSession.setStatusDismissed(true)}" update="@form" value="&#215;" />
<!-- <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&#215;</span></button>-->
<h:outputText styleClass="highlightBold" value="#{!empty settingsWrapper.get(':StatusMessageHeader') ? settingsWrapper.get(':StatusMessageHeader') : bundle['header.status.header']}"/>
<h:outputText rendered="#{!empty settingsWrapper.get(':StatusMessageText')}" value=" – #{settingsWrapper.get(':StatusMessageText')}" escape="false"/>
Expand Down

0 comments on commit a29a8fc

Please sign in to comment.