Skip to content

Commit

Permalink
fixed admin authentication provider
Browse files Browse the repository at this point in the history
  • Loading branch information
car031 committed Jan 23, 2025
1 parent 2f9f29e commit 89fc4a5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.logicaldoc.core.security.spring;

import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Collection;

Expand Down Expand Up @@ -50,6 +51,11 @@ public Authentication authenticate(Authentication authentication) throws Authent

User user = new User();
user.setUsername(ADMIN);
try {
user.setDecodedPassword(String.valueOf(auth.getCredentials()));
} catch (NoSuchAlgorithmException e) {
log.error(e.getMessage(), e);
}

UserDAO uDao = Context.get(UserDAO.class);

Expand All @@ -62,7 +68,7 @@ public Authentication authenticate(Authentication authentication) throws Authent
long userId = uDao.queryForLong("select ld_id from ld_user where ld_username='admin' and ld_deleted=0");
dbAvailable = userId == 1L;
} catch (Exception t) {
// Noting to do
log.error(t.getMessage(), t);
}

String adminPasswd = null;
Expand All @@ -73,7 +79,7 @@ public Authentication authenticate(Authentication authentication) throws Authent
adminPasswd = uDao
.queryForString("select ld_password from ld_user where ld_username='admin' and ld_deleted=0");
} catch (Exception t) {
// Noting to do
log.error(t.getMessage(), t);
}
} else {
// If the database is not available, get the password from the
Expand All @@ -82,7 +88,7 @@ public Authentication authenticate(Authentication authentication) throws Authent
ContextProperties config = Context.get().getProperties();
adminPasswd = config.getProperty("adminpasswd");
} catch (Exception t) {
// Noting to do
log.error(t.getMessage(), t);
}
}

Expand Down
5 changes: 2 additions & 3 deletions logicaldoc-gui/war/login.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<%! static String LOGIN_PAGE="login.jsp"; %>
<%@ include file="header.jsp" %>
<%@ include file="detectmobile.jsp" %>
<link REL="STYLESHEET" HREF="<%=MODULE%>/sc/skins/<%=SKIN%>/style-login.css" TYPE="text/css" />

<script type="text/javascript">
var j_loginurl='${pageContext.request.contextPath}/<%=LOGIN_PAGE%>';
Expand Down Expand Up @@ -49,6 +48,6 @@

<%@ include file="body.jsp" %>

<link REL="STYLESHEET" HREF="<%=MODULE%>/sc/skins/<%=SKIN%>/style-login.css" TYPE="text/css" />
<%@ include file="footer.jsp" %>

<%@ include file="footer.jsp" %>
<link REL="STYLESHEET" HREF="<%=MODULE%>/sc/skins/<%=SKIN%>/style-login.css" TYPE="text/css" />
3 changes: 2 additions & 1 deletion logicaldoc-gui/war/skin-Shiva/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
}

.warn {
background-color: rgb(255, 255, 161);
background-color: #FFFFA1;
}

.diff {
Expand Down Expand Up @@ -483,6 +483,7 @@
left:0;
}


/*
* Shiva overrides
*/
Expand Down

0 comments on commit 89fc4a5

Please sign in to comment.