mirror of
https://gitee.com/dromara/MaxKey.git
synced 2025-12-07 01:18:27 +08:00
image change to base 64
This commit is contained in:
parent
4485e14a53
commit
c810401040
@ -0,0 +1,142 @@
|
|||||||
|
/*
|
||||||
|
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package org.maxkey.web.contorller;
|
||||||
|
|
||||||
|
import com.google.code.kaptcha.Producer;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Base64;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
import javax.servlet.ServletOutputStream;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ImageCaptchaEndpoint Producer captcha.
|
||||||
|
* @author Crystal.Sea
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
public class ImageCaptchaBase64Endpoint {
|
||||||
|
private static final Logger _logger = LoggerFactory.getLogger(ImageCaptchaBase64Endpoint.class);
|
||||||
|
|
||||||
|
public static final String IMAGE_GIF = "image/gif";
|
||||||
|
|
||||||
|
public static final String KAPTCHA_SESSION_KEY = "kaptcha_session_key";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private Producer captchaProducer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* captcha image Producer.
|
||||||
|
*
|
||||||
|
* @param request HttpServletRequest
|
||||||
|
* @param response HttpServletResponse
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/captcha/base64")
|
||||||
|
public void captchaHandleRequest(HttpServletRequest request,
|
||||||
|
HttpServletResponse response,
|
||||||
|
@RequestParam(value="captcha",required=false,defaultValue="text") String captchaType) {
|
||||||
|
try {
|
||||||
|
|
||||||
|
String kaptchaText = captchaProducer.createText();
|
||||||
|
if (captchaType.equalsIgnoreCase("Arithmetic")) {
|
||||||
|
Integer intParamA = Integer.valueOf(kaptchaText.substring(0, 1));
|
||||||
|
Integer intParamB = Integer.valueOf(kaptchaText.substring(1, 2));
|
||||||
|
Integer calculateValue = 0;
|
||||||
|
if ((intParamA > intParamB) && ((intParamA + intParamB) % 5 > 3)) {
|
||||||
|
calculateValue = intParamA - intParamB;
|
||||||
|
kaptchaText = intParamA + "-" + intParamB + "=?";
|
||||||
|
} else {
|
||||||
|
calculateValue = intParamA + intParamB;
|
||||||
|
kaptchaText = intParamA + "+" + intParamB + "=?";
|
||||||
|
}
|
||||||
|
_logger.trace("Sesssion id " + request.getSession().getId()
|
||||||
|
+ " , Arithmetic calculate Value is " + calculateValue);
|
||||||
|
request.getSession().setAttribute(
|
||||||
|
KAPTCHA_SESSION_KEY, calculateValue + "");
|
||||||
|
} else {
|
||||||
|
// store the text in the session
|
||||||
|
request.getSession().setAttribute(KAPTCHA_SESSION_KEY, kaptchaText);
|
||||||
|
}
|
||||||
|
_logger.trace("Sesssion id " + request.getSession().getId()
|
||||||
|
+ " , Captcha Text is " + kaptchaText);
|
||||||
|
|
||||||
|
// create the image with the text
|
||||||
|
BufferedImage bufferedImage = captchaProducer.createImage(kaptchaText);
|
||||||
|
producerImage(request,response,bufferedImage);
|
||||||
|
} catch (Exception e) {
|
||||||
|
_logger.error("captcha Producer Error " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* producerImage.
|
||||||
|
* @param request HttpServletRequest
|
||||||
|
* @param response HttpServletResponse
|
||||||
|
* @param bufferedImage BufferedImage
|
||||||
|
* @throws IOException error
|
||||||
|
*/
|
||||||
|
public static void producerImage(HttpServletRequest request,
|
||||||
|
HttpServletResponse response,
|
||||||
|
BufferedImage bufferedImage) throws IOException {
|
||||||
|
// Set to expire far in the past.
|
||||||
|
response.setDateHeader("Expires", 0);
|
||||||
|
// Set standard HTTP/1.1 no-cache headers.
|
||||||
|
response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
|
||||||
|
// Set IE extended HTTP/1.1 no-cache headers (use addHeader).
|
||||||
|
response.addHeader("Cache-Control", "post-check=0, pre-check=0");
|
||||||
|
// Set standard HTTP/1.0 no-cache header.
|
||||||
|
response.setHeader("Pragma", "no-cache");
|
||||||
|
// return a jpeg/gif
|
||||||
|
//response.setContentType(IMAGE_GIF);
|
||||||
|
_logger.trace("create the image");
|
||||||
|
// create the image
|
||||||
|
if (bufferedImage != null) {
|
||||||
|
ServletOutputStream out = response.getOutputStream();
|
||||||
|
// write the data out
|
||||||
|
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||||
|
ImageIO.write(bufferedImage, "png", stream);
|
||||||
|
String b64Image = "data:image/png;base64," + Base64.getEncoder().encodeToString(stream.toByteArray());
|
||||||
|
out.print(b64Image);
|
||||||
|
_logger.debug("b64Image {}" , b64Image);
|
||||||
|
stream.close();
|
||||||
|
try {
|
||||||
|
out.flush();
|
||||||
|
} finally {
|
||||||
|
out.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCaptchaProducer(Producer captchaProducer) {
|
||||||
|
this.captchaProducer = captchaProducer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -19,6 +19,7 @@ package org.maxkey.entity;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Base64;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -101,6 +102,7 @@ public class UserInfo extends JpaBaseEntity {
|
|||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
@Column
|
@Column
|
||||||
protected byte[] picture;
|
protected byte[] picture;
|
||||||
|
protected String pictureBase64;
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
protected MultipartFile pictureFile;
|
protected MultipartFile pictureFile;
|
||||||
@Column
|
@Column
|
||||||
@ -399,6 +401,21 @@ public class UserInfo extends JpaBaseEntity {
|
|||||||
return picture;
|
return picture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getPictureBase64() {
|
||||||
|
return pictureBase64;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPictureBase64(String pictureBase64) {
|
||||||
|
this.pictureBase64 = pictureBase64;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void transPictureBase64() {
|
||||||
|
if(picture != null) {
|
||||||
|
this.pictureBase64 = "data:image/png;base64," +
|
||||||
|
Base64.getEncoder().encodeToString(picture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the protectedAppsMap
|
* @return the protectedAppsMap
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -18,6 +18,7 @@
|
|||||||
package org.maxkey.entity.apps;
|
package org.maxkey.entity.apps;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.Base64;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
@ -78,6 +79,7 @@ public class Apps extends JpaBaseEntity implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@Column
|
@Column
|
||||||
private byte[] icon;
|
private byte[] icon;
|
||||||
|
private String iconBase64;
|
||||||
private MultipartFile iconFile;
|
private MultipartFile iconFile;
|
||||||
@Column
|
@Column
|
||||||
private int visible;
|
private int visible;
|
||||||
@ -270,6 +272,21 @@ public class Apps extends JpaBaseEntity implements Serializable {
|
|||||||
this.icon = icon;
|
this.icon = icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getIconBase64() {
|
||||||
|
return iconBase64;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIconBase64(String iconBase64) {
|
||||||
|
this.iconBase64 = iconBase64;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void transIconBase64() {
|
||||||
|
if(icon !=null) {
|
||||||
|
this.iconBase64 = "data:image/png;base64," +
|
||||||
|
Base64.getEncoder().encodeToString(icon);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the iconFile
|
* @return the iconFile
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -96,7 +96,7 @@ public class AppListController {
|
|||||||
userApplications.setInstId(WebContext.getUserInfo().getInstId());
|
userApplications.setInstId(WebContext.getUserInfo().getInstId());
|
||||||
List<UserApps> appList = appsService.queryMyApps(userApplications);
|
List<UserApps> appList = appsService.queryMyApps(userApplications);
|
||||||
for (UserApps app : appList) {
|
for (UserApps app : appList) {
|
||||||
WebContext.setAttribute(app.getId(), app.getIcon());
|
app.transIconBase64();
|
||||||
}
|
}
|
||||||
|
|
||||||
return appList;
|
return appList;
|
||||||
|
|||||||
@ -47,7 +47,7 @@ public class ProfileController {
|
|||||||
public ModelAndView forwardBasic() {
|
public ModelAndView forwardBasic() {
|
||||||
ModelAndView modelAndView = new ModelAndView("profile/myProfile");
|
ModelAndView modelAndView = new ModelAndView("profile/myProfile");
|
||||||
UserInfo userInfo = userInfoService.findByUsername(WebContext.getUserInfo().getUsername());
|
UserInfo userInfo = userInfoService.findByUsername(WebContext.getUserInfo().getUsername());
|
||||||
WebContext.getSession().setAttribute(userInfo.getId(), userInfo.getPicture());
|
userInfo.transPictureBase64();
|
||||||
|
|
||||||
// HashMap<String,Object>extraAttributeMap=new HashMap<String,Object>();
|
// HashMap<String,Object>extraAttributeMap=new HashMap<String,Object>();
|
||||||
// extraAttributeMap=(HashMap<String,Object>)JsonUtils.json2Object(userInfo.getExtraAttribute(),extraAttributeMap);
|
// extraAttributeMap=(HashMap<String,Object>)JsonUtils.json2Object(userInfo.getExtraAttribute(),extraAttributeMap);
|
||||||
|
|||||||
@ -34,7 +34,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>${app_index +1 }</td>
|
<td>${app_index +1 }</td>
|
||||||
<td>
|
<td>
|
||||||
<img src="<@base/>/image/${app.id}" title="${app.name}" width="65px" height="65px" style="border:0;"/>
|
<img src="${app.iconBase64}" title="${app.name}" width="65px" height="65px" style="border:0;"/>
|
||||||
</td>
|
</td>
|
||||||
<td>${app.name}</td>
|
<td>${app.name}</td>
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
@ -31,7 +31,7 @@
|
|||||||
<#if "IDP"==app.inducer>
|
<#if "IDP"==app.inducer>
|
||||||
href="<@base/>/authz/${app.id}"
|
href="<@base/>/authz/${app.id}"
|
||||||
</#if> >
|
</#if> >
|
||||||
<img src="<@base/>/image/${app.id}" title="${app.name}" class="appListimage"/>
|
<img src="${app.iconBase64}" title="${app.name}" class="appListimage"/>
|
||||||
</a><br>
|
</a><br>
|
||||||
${app.name}
|
${app.name}
|
||||||
</td></tr>
|
</td></tr>
|
||||||
@ -76,7 +76,7 @@
|
|||||||
href="<@base/>/authz/${app.id}"
|
href="<@base/>/authz/${app.id}"
|
||||||
</#if>
|
</#if>
|
||||||
target="_blank" title="${app.name}" >
|
target="_blank" title="${app.name}" >
|
||||||
<img src="<@base/>/image/${app.id}" title="${app.name}" class="appListimage"/>
|
<img src="${app.iconBase64}" title="${app.name}" class="appListimage"/>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td style="">${app.name}</td>
|
<td style="">${app.name}</td>
|
||||||
|
|||||||
@ -314,7 +314,7 @@
|
|||||||
<td>
|
<td>
|
||||||
<img id="picture" width="150px" height="215px"
|
<img id="picture" width="150px" height="215px"
|
||||||
<#if model.picture ?? >
|
<#if model.picture ?? >
|
||||||
src="<@base/>/image/${model.id}" />
|
src="${model.pictureBase64}" />
|
||||||
<#else>
|
<#else>
|
||||||
src="<@base/>/static/images/uploadimage.jpg" />
|
src="<@base/>/static/images/uploadimage.jpg" />
|
||||||
</#if>
|
</#if>
|
||||||
|
|||||||
@ -77,7 +77,7 @@ public class ApplicationsController extends BaseAppContorller {
|
|||||||
JpaPageResults<Apps> apps=appsService.queryPageResults(applications);
|
JpaPageResults<Apps> apps=appsService.queryPageResults(applications);
|
||||||
if(apps!=null&&apps.getRows()!=null){
|
if(apps!=null&&apps.getRows()!=null){
|
||||||
for (Apps app : apps.getRows()){
|
for (Apps app : apps.getRows()){
|
||||||
WebContext.setAttribute(app.getId(), app.getIcon());
|
app.transIconBase64();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return apps;
|
return apps;
|
||||||
|
|||||||
@ -72,7 +72,7 @@ public class BasicDetailsController extends BaseAppContorller {
|
|||||||
ModelAndView modelAndView=new ModelAndView("apps/basic/appUpdate");
|
ModelAndView modelAndView=new ModelAndView("apps/basic/appUpdate");
|
||||||
Apps appDetails=appsService.get(id);
|
Apps appDetails=appsService.get(id);
|
||||||
super.decoderSecret(appDetails);
|
super.decoderSecret(appDetails);
|
||||||
WebContext.setAttribute(appDetails.getId(), appDetails.getIcon());
|
appDetails.transIconBase64();
|
||||||
modelAndView.addObject("model",appDetails);
|
modelAndView.addObject("model",appDetails);
|
||||||
return modelAndView;
|
return modelAndView;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -76,7 +76,7 @@ public class CasDetailsController extends BaseAppContorller {
|
|||||||
ModelAndView modelAndView=new ModelAndView("apps/cas/appUpdate");
|
ModelAndView modelAndView=new ModelAndView("apps/cas/appUpdate");
|
||||||
AppsCasDetails casDetails=casDetailsService.getAppDetails(id , false);
|
AppsCasDetails casDetails=casDetailsService.getAppDetails(id , false);
|
||||||
super.decoderSecret(casDetails);
|
super.decoderSecret(casDetails);
|
||||||
WebContext.setAttribute(casDetails.getId(), casDetails.getIcon());
|
casDetails.transIconBase64();
|
||||||
|
|
||||||
modelAndView.addObject("model",casDetails);
|
modelAndView.addObject("model",casDetails);
|
||||||
return modelAndView;
|
return modelAndView;
|
||||||
|
|||||||
@ -76,8 +76,7 @@ public class ExtendApiDetailsController extends BaseAppContorller {
|
|||||||
super.decoderSecret(application);
|
super.decoderSecret(application);
|
||||||
AppsExtendApiDetails extendApiDetails=new AppsExtendApiDetails();
|
AppsExtendApiDetails extendApiDetails=new AppsExtendApiDetails();
|
||||||
BeanUtils.copyProperties(application, extendApiDetails);
|
BeanUtils.copyProperties(application, extendApiDetails);
|
||||||
|
extendApiDetails.transIconBase64();
|
||||||
WebContext.setAttribute(extendApiDetails.getId(), extendApiDetails.getIcon());
|
|
||||||
|
|
||||||
modelAndView.addObject("model",extendApiDetails);
|
modelAndView.addObject("model",extendApiDetails);
|
||||||
return modelAndView;
|
return modelAndView;
|
||||||
|
|||||||
@ -80,7 +80,7 @@ public class FormBasedDetailsController extends BaseAppContorller {
|
|||||||
AppsFormBasedDetails formBasedDetails=formBasedDetailsService.getAppDetails(id , false);
|
AppsFormBasedDetails formBasedDetails=formBasedDetailsService.getAppDetails(id , false);
|
||||||
decoderSecret(formBasedDetails);
|
decoderSecret(formBasedDetails);
|
||||||
decoderSharedPassword(formBasedDetails);
|
decoderSharedPassword(formBasedDetails);
|
||||||
WebContext.setAttribute(formBasedDetails.getId(), formBasedDetails.getIcon());
|
formBasedDetails.transIconBase64();
|
||||||
|
|
||||||
modelAndView.addObject("model",formBasedDetails);
|
modelAndView.addObject("model",formBasedDetails);
|
||||||
return modelAndView;
|
return modelAndView;
|
||||||
|
|||||||
@ -79,7 +79,7 @@ public class JwtDetailsController extends BaseAppContorller {
|
|||||||
ModelAndView modelAndView=new ModelAndView("apps/jwt/appUpdate");
|
ModelAndView modelAndView=new ModelAndView("apps/jwt/appUpdate");
|
||||||
AppsJwtDetails jwtDetails=jwtDetailsService.getAppDetails(id , false);
|
AppsJwtDetails jwtDetails=jwtDetailsService.getAppDetails(id , false);
|
||||||
decoderSecret(jwtDetails);
|
decoderSecret(jwtDetails);
|
||||||
WebContext.setAttribute(jwtDetails.getId(), jwtDetails.getIcon());
|
jwtDetails.transIconBase64();
|
||||||
|
|
||||||
modelAndView.addObject("model",jwtDetails);
|
modelAndView.addObject("model",jwtDetails);
|
||||||
return modelAndView;
|
return modelAndView;
|
||||||
|
|||||||
@ -94,7 +94,7 @@ public class OAuth20DetailsController extends BaseAppContorller {
|
|||||||
oauth20Details.setSecret(application.getSecret());
|
oauth20Details.setSecret(application.getSecret());
|
||||||
oauth20Details.setClientSecret(application.getSecret());
|
oauth20Details.setClientSecret(application.getSecret());
|
||||||
_logger.debug("forwardUpdate "+oauth20Details);
|
_logger.debug("forwardUpdate "+oauth20Details);
|
||||||
WebContext.setAttribute(oauth20Details.getId(), oauth20Details.getIcon());
|
oauth20Details.transIconBase64();
|
||||||
modelAndView.addObject("model",oauth20Details);
|
modelAndView.addObject("model",oauth20Details);
|
||||||
return modelAndView;
|
return modelAndView;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -106,7 +106,7 @@ public class SAML20DetailsController extends BaseAppContorller {
|
|||||||
ModelAndView modelAndView=new ModelAndView("apps/saml20/appUpdate");
|
ModelAndView modelAndView=new ModelAndView("apps/saml20/appUpdate");
|
||||||
AppsSAML20Details saml20Details=saml20DetailsService.getAppDetails(id , false);
|
AppsSAML20Details saml20Details=saml20DetailsService.getAppDetails(id , false);
|
||||||
decoderSecret(saml20Details);
|
decoderSecret(saml20Details);
|
||||||
WebContext.setAttribute(saml20Details.getId(), saml20Details.getIcon());
|
saml20Details.transIconBase64();
|
||||||
modelAndView.addObject("model",saml20Details);
|
modelAndView.addObject("model",saml20Details);
|
||||||
modelAndView.addObject("authzURI",applicationConfig.getAuthzUri());
|
modelAndView.addObject("authzURI",applicationConfig.getAuthzUri());
|
||||||
return modelAndView;
|
return modelAndView;
|
||||||
|
|||||||
@ -83,7 +83,7 @@ public class TokenBasedDetailsController extends BaseAppContorller {
|
|||||||
decoderSecret(tokenBasedDetails);
|
decoderSecret(tokenBasedDetails);
|
||||||
String algorithmKey=passwordReciprocal.decoder(tokenBasedDetails.getAlgorithmKey());
|
String algorithmKey=passwordReciprocal.decoder(tokenBasedDetails.getAlgorithmKey());
|
||||||
tokenBasedDetails.setAlgorithmKey(algorithmKey);
|
tokenBasedDetails.setAlgorithmKey(algorithmKey);
|
||||||
WebContext.setAttribute(tokenBasedDetails.getId(), tokenBasedDetails.getIcon());
|
tokenBasedDetails.transIconBase64();
|
||||||
|
|
||||||
modelAndView.addObject("model",tokenBasedDetails);
|
modelAndView.addObject("model",tokenBasedDetails);
|
||||||
return modelAndView;
|
return modelAndView;
|
||||||
|
|||||||
@ -62,7 +62,7 @@ public class GroupPrivilegesController {
|
|||||||
|
|
||||||
if(groupPrivileges!=null&&groupPrivileges.getRows()!=null){
|
if(groupPrivileges!=null&&groupPrivileges.getRows()!=null){
|
||||||
for (Apps app : groupPrivileges.getRows()){
|
for (Apps app : groupPrivileges.getRows()){
|
||||||
WebContext.setAttribute(app.getId(), app.getIcon());
|
app.transIconBase64();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return groupPrivileges;
|
return groupPrivileges;
|
||||||
@ -86,7 +86,7 @@ public class GroupPrivilegesController {
|
|||||||
|
|
||||||
if(groupPrivileges!=null&&groupPrivileges.getRows()!=null){
|
if(groupPrivileges!=null&&groupPrivileges.getRows()!=null){
|
||||||
for (Apps app : groupPrivileges.getRows()){
|
for (Apps app : groupPrivileges.getRows()){
|
||||||
WebContext.setAttribute(app.getId(), app.getIcon());
|
app.transIconBase64();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return groupPrivileges;
|
return groupPrivileges;
|
||||||
|
|||||||
@ -145,7 +145,7 @@ public class UserInfoController {
|
|||||||
ModelAndView modelAndView=new ModelAndView("/userinfo/userUpdate");
|
ModelAndView modelAndView=new ModelAndView("/userinfo/userUpdate");
|
||||||
UserInfo userInfo=userInfoService.get(id);
|
UserInfo userInfo=userInfoService.get(id);
|
||||||
if(userInfo.getPicture()!=null){
|
if(userInfo.getPicture()!=null){
|
||||||
WebContext.getSession().setAttribute(userInfo.getId(), userInfo.getPicture());
|
userInfo.transPictureBase64();
|
||||||
}
|
}
|
||||||
|
|
||||||
modelAndView.addObject("model", userInfo);
|
modelAndView.addObject("model", userInfo);
|
||||||
|
|||||||
@ -33,7 +33,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<th><@locale code="apps.icon"/></th>
|
<th><@locale code="apps.icon"/></th>
|
||||||
<td>
|
<td>
|
||||||
<img id="iconFileImg" height='30' src='<@base/>/image/${model.id!}'/>
|
<img id="iconFileImg" height='30' src='${model.iconBase64!}'/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<#include "../layout/common.cssjs.ftl"/>
|
<#include "../layout/common.cssjs.ftl"/>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function iconFormatter(value, row, index){
|
function iconFormatter(value, row, index){
|
||||||
return "<img height='30' border='0px' src='<@base/>/image/"+value+"'/>";
|
return "<img height='30' border='0px' src='"+value+"'";
|
||||||
};
|
};
|
||||||
|
|
||||||
function vendorFormatter(value, options, rData){
|
function vendorFormatter(value, options, rData){
|
||||||
@ -198,7 +198,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th data-checkbox="true"></th>
|
<th data-checkbox="true"></th>
|
||||||
<th data-sortable="true" data-field="id" data-visible="false">Id</th>
|
<th data-sortable="true" data-field="id" data-visible="false">Id</th>
|
||||||
<th data-field="id" data-formatter="iconFormatter"><@locale code="apps.icon"/></th>
|
<th data-field="iconBase64" data-formatter="iconFormatter"><@locale code="apps.icon"/></th>
|
||||||
<th data-field="name"><@locale code="apps.name"/></th>
|
<th data-field="name"><@locale code="apps.name"/></th>
|
||||||
<th data-field="protocol"><@locale code="apps.protocol"/></th>
|
<th data-field="protocol"><@locale code="apps.protocol"/></th>
|
||||||
<th data-field="category"><@locale code="apps.category"/></th>
|
<th data-field="category"><@locale code="apps.category"/></th>
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function iconFormatter(value, row, index){
|
function iconFormatter(value, row, index){
|
||||||
return "<img height='30' border='0px' src='<@base/>/image/"+value+"'/>";
|
return "<img height='30' border='0px' src='"+value+"'";
|
||||||
};
|
};
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
@ -71,7 +71,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th data-checkbox="true"></th>
|
<th data-checkbox="true"></th>
|
||||||
<th data-sortable="true" data-field="id" data-visible="false">Id</th>
|
<th data-sortable="true" data-field="id" data-visible="false">Id</th>
|
||||||
<th data-field="id" data-formatter="iconFormatter"><@locale code="apps.icon"/></th>
|
<th data-field="iconBase64" data-formatter="iconFormatter"><@locale code="apps.icon"/></th>
|
||||||
<th data-field="name"><@locale code="apps.name"/></th>
|
<th data-field="name"><@locale code="apps.name"/></th>
|
||||||
<th data-field="protocol" data-visible="false"><@locale code="apps.protocol"/></th>
|
<th data-field="protocol" data-visible="false"><@locale code="apps.protocol"/></th>
|
||||||
<th data-field="category"><@locale code="apps.category"/></th>
|
<th data-field="category"><@locale code="apps.category"/></th>
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function iconFormatter(value, row, index){
|
function iconFormatter(value, row, index){
|
||||||
return "<img height='30' border='0px' src='<@base/>/image/"+value+"'/>";
|
return "<img height='30' border='0px' src='"+value+"'";
|
||||||
};
|
};
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
@ -115,7 +115,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th data-checkbox="true"></th>
|
<th data-checkbox="true"></th>
|
||||||
<th data-sortable="true" data-field="id" data-visible="false">Id</th>
|
<th data-sortable="true" data-field="id" data-visible="false">Id</th>
|
||||||
<th data-field="id" data-formatter="iconFormatter"><@locale code="apps.icon"/></th>
|
<th data-field="iconBase64" data-formatter="iconFormatter"><@locale code="apps.icon"/></th>
|
||||||
<th data-field="name"><@locale code="apps.name"/></th>
|
<th data-field="name"><@locale code="apps.name"/></th>
|
||||||
<th data-field="protocol" data-visible="false"><@locale code="apps.protocol"/></th>
|
<th data-field="protocol" data-visible="false"><@locale code="apps.protocol"/></th>
|
||||||
<th data-field="category"><@locale code="apps.category"/></th>
|
<th data-field="category"><@locale code="apps.category"/></th>
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
function iconFormatter(value, row, index){
|
function iconFormatter(value, row, index){
|
||||||
return "<img height='30' border='0px' src='<@base/>/image/"+value+"'/>";
|
return "<img height='30' border='0px' src='"+value+"'";
|
||||||
};
|
};
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
@ -129,7 +129,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th data-checkbox="true"></th>
|
<th data-checkbox="true"></th>
|
||||||
<th data-sortable="true" data-field="id" data-visible="false">Id</th>
|
<th data-sortable="true" data-field="id" data-visible="false">Id</th>
|
||||||
<th data-field="id" data-formatter="iconFormatter"><@locale code="apps.icon"/></th>
|
<th data-field="iconBase64" data-formatter="iconFormatter"><@locale code="apps.icon"/></th>
|
||||||
<th data-field="name"><@locale code="apps.name"/></th>
|
<th data-field="name"><@locale code="apps.name"/></th>
|
||||||
<th data-field="protocol" data-visible="false"><@locale code="apps.protocol"/></th>
|
<th data-field="protocol" data-visible="false"><@locale code="apps.protocol"/></th>
|
||||||
<th data-field="category"><@locale code="apps.category"/></th>
|
<th data-field="category"><@locale code="apps.category"/></th>
|
||||||
|
|||||||
@ -109,7 +109,13 @@
|
|||||||
</td>
|
</td>
|
||||||
<td rowspan="3"><@locale code="userinfo.picture" /></td>
|
<td rowspan="3"><@locale code="userinfo.picture" /></td>
|
||||||
<td rowspan="3">
|
<td rowspan="3">
|
||||||
<img id="picture" width="150px" height="150px" src="<@base/>/static/images/uploadimage.jpg" />
|
<img id="picture" width="150px" height="150px"
|
||||||
|
<#if model.pictureBase64 ?? >
|
||||||
|
src="${model.pictureBase64}"
|
||||||
|
<#else>
|
||||||
|
src="<@base/>/static/images/uploadimage.jpg"
|
||||||
|
</#if>
|
||||||
|
/>
|
||||||
<input type="file" id="pictureFile" name="pictureFile" style="display:none" />
|
<input type="file" id="pictureFile" name="pictureFile" style="display:none" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@ -288,14 +288,6 @@ body{
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#j_captchaimg{
|
|
||||||
width:70px;
|
|
||||||
height: 35px;
|
|
||||||
vertical-align: top;
|
|
||||||
}
|
|
||||||
|
|
||||||
.login_form_table #j_captchaimg{
|
.login_form_table #j_captchaimg{
|
||||||
width: 100px;
|
width: 100px;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
|
|||||||
@ -29,10 +29,36 @@ $(function(){
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
var captchaImageUrl = $('.captcha-image').attr("src");
|
|
||||||
|
//captcha-image
|
||||||
|
if($('.captcha-image').length > 0){
|
||||||
|
$('.captcha-image').attr("url",
|
||||||
|
$('.captcha-image').attr("src").indexOf("?")>-1?
|
||||||
|
$('.captcha-image').attr("src"):$('.captcha-image').attr("src")+"?data=img");
|
||||||
|
}
|
||||||
//on captcha image click ,new a captcha code
|
//on captcha image click ,new a captcha code
|
||||||
$('.captcha-image').click(function () {//
|
$('.captcha-image').click(function () {//
|
||||||
$(this).attr("src", captchaImageUrl+"&"+(new Date()).getTime());
|
$(this).attr("src", $(this).attr("url")+"&"+(new Date()).getTime());
|
||||||
|
});
|
||||||
|
|
||||||
|
//captcha-imageb64
|
||||||
|
if($('.captcha-imageb64').length > 0){
|
||||||
|
$('.captcha-imageb64').attr("url",
|
||||||
|
$('.captcha-imageb64').attr("src").indexOf("?")>-1?
|
||||||
|
$('.captcha-imageb64').attr("src"):$('.captcha-imageb64').attr("src")+"?data=img");
|
||||||
|
}
|
||||||
|
$(".captcha-imageb64").each(function(){
|
||||||
|
var _this = this;
|
||||||
|
$.get($(this).attr("url")+"&"+(new Date()).getTime(), function(result){
|
||||||
|
$(_this).attr("src",result);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
//on captcha image click ,new a captcha code
|
||||||
|
$('.captcha-imageb64').click(function () {//
|
||||||
|
var _this = this;
|
||||||
|
$.get($(this).attr("url")+"&"+(new Date()).getTime(), function(result){
|
||||||
|
$(_this).attr("src",result);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
//passwdeye
|
//passwdeye
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user