Skip to content

Commit

Permalink
Merge pull request #242 from diging/develop
Browse files Browse the repository at this point in the history
Story/vspc 183 (#241)
  • Loading branch information
jdamerow authored Aug 12, 2021
2 parents 68e32b8 + 101be79 commit 35e8976
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 19 deletions.
2 changes: 1 addition & 1 deletion vspace/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<log.level>debug</log.level>

<db.driver>com.mysql.jdbc.Driver</db.driver>
<db.url>jdbc:mysql://localhost:3306/vspace?serverTimezone=UTC</db.url>
<db.url>jdbc:mysql://localhost:3306/vspace?serverTimezone=UTC&amp;useEncoding=true</db.url>
<db.user>vspace</db.user>
<db.password>vspace</db.password>
<uploaded.files.path></uploaded.files.path>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
package edu.asu.diging.vspace.config;

import java.nio.charset.StandardCharsets;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.web.csrf.CsrfFilter;
import org.springframework.web.filter.CharacterEncodingFilter;

import edu.asu.diging.simpleusers.core.service.SimpleUsersConstants;

Expand All @@ -24,7 +28,12 @@ public void configure(WebSecurity web) throws Exception {

@Override
protected void configure(HttpSecurity http) throws Exception {
http.formLogin()
CharacterEncodingFilter filter = new CharacterEncodingFilter();
filter.setEncoding(StandardCharsets.UTF_8.name());
filter.setForceEncoding(true);
http.addFilterBefore(filter,CsrfFilter.class);

http.formLogin()
.loginPage("/login")
.loginProcessingUrl("/login")
.failureUrl("/login?error=bad_credentials")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package edu.asu.diging.vspace.config;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;

import org.apache.commons.io.Charsets;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
Expand All @@ -26,7 +25,7 @@ public SpringResourceTemplateResolver templateResolver() {
// resource resolution infrastructure, which is highly recommended.
SpringResourceTemplateResolver templateResolver = new SpringResourceTemplateResolver();
templateResolver.setApplicationContext(this.applicationContext);
templateResolver.setCharacterEncoding(Charset.defaultCharset().toString());
templateResolver.setCharacterEncoding(StandardCharsets.UTF_8.name());
templateResolver.setPrefix("/WEB-INF/views/");
templateResolver.setSuffix(".html");
// HTML is the default value, added here for the sake of clarity.
Expand Down Expand Up @@ -58,7 +57,7 @@ public SpringTemplateEngine templateEngine() {
public ThymeleafViewResolver viewResolver() {
ThymeleafViewResolver viewResolver = new ThymeleafViewResolver();
viewResolver.setTemplateEngine(templateEngine());
viewResolver.setCharacterEncoding(Charset.defaultCharset().toString());
viewResolver.setCharacterEncoding(StandardCharsets.UTF_8.name());
return viewResolver;
}
}
22 changes: 11 additions & 11 deletions vspace/src/main/webapp/WEB-INF/views/exhibition/space.html
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@
var externalLinks = [[${externalLinkList}]];
var height = parseInt($("#bgImage").css("height"));
var width = parseInt($("#bgImage").css("width"));
let relativeHeight = ([(${display.width})]/width)*height;
let relativeHeight = ([(${display?.width})]/width)*height;
spaceLinks.forEach(function(link,index){
if(link!=null){
var posX = parseInt($("#space").css('margin-left')) + $("#space").position().left;
Expand All @@ -309,7 +309,7 @@
linkDisplay.css('transform', 'rotate('+link.rotation+'deg)');
linkDisplay.css('fill', 'grey');
linkDisplay.css('color', 'rgba(128,128,128,1)');
var linkPosX=(width*link.positionX)/[(${display.width})];
var linkPosX=(width*link.positionX)/[(${display?.width})];
var linkPosY=(height*link.positionY)/relativeHeight;
linkDisplay.css('left',linkPosX + posX);
linkDisplay.css('top', linkPosY + posY);
Expand All @@ -330,14 +330,14 @@
var posX = parseInt($("#space").css('margin-left')) + $("#space").position().left;
var posY = $("#space").position().top;
var moduleLink = $('<a></a>');
var moduleLinkURL = [[@{|/exhibit/${space.id}/module/|}]]+link.link.module.id;
var moduleLinkURL = [[@{|/exhibit/${space?.id}/module/|}]]+link.link.module.id;
moduleLink.attr("href", moduleLinkURL);
var linkDisplay = $('<div class="InfoModule_'+index+' Info_cz_Class"><svg class="Ellipse_8_c"><ellipse fill="rgba(222,222,222,1)" class="Ellipse_8_c_Class" rx="14.5" ry="14.5" cx="14.5" cy="14.5"></ellipse></svg><svg class="Ellipse_10_c"><ellipse fill="rgba(240,240,240,1)" class="Ellipse_10_c_Class" rx="12.5" ry="12.5" cx="12.5" cy="12.5"></ellipse></svg><svg class="Ellipse_9_c"><ellipse fill="rgba(255,255,255,1)" class="Ellipse_9_c_Class" rx="10.5" ry="10.5" cx="10.5" cy="10.5"></ellipse></svg><span class="icon-info Icon_awesome_info_m"></span><span class="tooltiptext">'+link.link.name+'</span></div>');
linkDisplay.css('position', 'absolute');
linkDisplay.css('transform', 'rotate('+link.rotation+'deg)');
linkDisplay.css('fill', 'grey');
linkDisplay.css('color', 'rgba(128,128,128,1)');
var linkPosX=(width*link.positionX)/[(${display.width})];
var linkPosX=(width*link.positionX)/[(${display?.width})];
var linkPosY=(height*link.positionY)/relativeHeight;
linkDisplay.css('left',linkPosX + posX);
linkDisplay.css('top', linkPosY + posY);
Expand Down Expand Up @@ -373,7 +373,7 @@
linkDisplay.css('transform', 'rotate('+link.rotation+'deg)');
linkDisplay.css('fill', 'grey');
linkDisplay.css('color', 'rgba(128,128,128,1)');
var linkPosX=(width*link.positionX)/[(${display.width})];
var linkPosX=(width*link.positionX)/[(${display?.width})];
var linkPosY=(height*link.positionY)/relativeHeight;
linkDisplay.css('left',linkPosX + posX);
linkDisplay.css('top', linkPosY + posY);
Expand Down Expand Up @@ -414,7 +414,7 @@
onclick="closeNav()">&times;</a>
<ul th:each="space: ${publishedSpaces}">
<li><a class="dropdown-item"
th:href="@{'/exhibit/space/'+${space.id}}">[[${space.name}]]</a>
th:href="@{'/exhibit/space/'+${space?.id}}">[[${space.name}]]</a>
</li>
</ul>
</div>
Expand All @@ -434,11 +434,11 @@
<li
th:if="${!#strings.isEmpty(module.link.name)}"><a
class="dropdown-item"
th:href="@{'/exhibit/'+${space.id}+'/module/'+${module.link.module.id}}"><div class="Info Info_cz_module_Class"><svg class="Ellipse_8_module_c_sidenav"><ellipse fill="rgba(222,222,222,1)" class="Ellipse_8_c_Class" rx="14.5" ry="14.5" cx="14.5" cy="14.5"></ellipse></svg><svg class="Ellipse_10_module_c_sidenav"><ellipse fill="rgba(240,240,240,1)" class="Ellipse_10_c_Class" rx="12.5" ry="12.5" cx="12.5" cy="12.5"></ellipse></svg><svg class="Ellipse_9_module_c_sidenav"><ellipse fill="rgba(255,255,255,1)" class="Ellipse_9_c_Class" rx="10.5" ry="10.5" cx="10.5" cy="10.5"></ellipse></svg><span class="icon-info Icon_awesome_info_module_m_sidenav"></span></div>[[${module.link.name}]]</a></li>
th:href="@{'/exhibit/'+${space?.id}+'/module/'+${module.link.module?.id}}"><div class="Info Info_cz_module_Class"><svg class="Ellipse_8_module_c_sidenav"><ellipse fill="rgba(222,222,222,1)" class="Ellipse_8_c_Class" rx="14.5" ry="14.5" cx="14.5" cy="14.5"></ellipse></svg><svg class="Ellipse_10_module_c_sidenav"><ellipse fill="rgba(240,240,240,1)" class="Ellipse_10_c_Class" rx="12.5" ry="12.5" cx="12.5" cy="12.5"></ellipse></svg><svg class="Ellipse_9_module_c_sidenav"><ellipse fill="rgba(255,255,255,1)" class="Ellipse_9_c_Class" rx="10.5" ry="10.5" cx="10.5" cy="10.5"></ellipse></svg><span class="icon-info Icon_awesome_info_module_m_sidenav"></span></div>[[${module.link.name}]]</a></li>
<li
th:if="${#strings.isEmpty(module.link.name)}"><a
class="dropdown-item"
th:href="@{'/exhibit/'+${space.id}+'/module/'+${module.link.module.id}}"><div class="Info Info_cz_module_Class"><svg class="Ellipse_8_module_c_sidenav"><ellipse fill="rgba(222,222,222,1)" class="Ellipse_8_c_Class" rx="14.5" ry="14.5" cx="14.5" cy="14.5"></ellipse></svg><svg class="Ellipse_10_module_c_sidenav"><ellipse fill="rgba(240,240,240,1)" class="Ellipse_10_c_Class" rx="12.5" ry="12.5" cx="12.5" cy="12.5"></ellipse></svg><svg class="Ellipse_9_module_c_sidenav"><ellipse fill="rgba(255,255,255,1)" class="Ellipse_9_c_Class" rx="10.5" ry="10.5" cx="10.5" cy="10.5"></ellipse></svg><span class="icon-info Icon_awesome_info_module_m_sidenav"></span></div>[[${module.link.module.name}]]</a></li>
th:href="@{'/exhibit/'+${space?.id}+'/module/'+${module.link.module?.id}}"><div class="Info Info_cz_module_Class"><svg class="Ellipse_8_module_c_sidenav"><ellipse fill="rgba(222,222,222,1)" class="Ellipse_8_c_Class" rx="14.5" ry="14.5" cx="14.5" cy="14.5"></ellipse></svg><svg class="Ellipse_10_module_c_sidenav"><ellipse fill="rgba(240,240,240,1)" class="Ellipse_10_c_Class" rx="12.5" ry="12.5" cx="12.5" cy="12.5"></ellipse></svg><svg class="Ellipse_9_module_c_sidenav"><ellipse fill="rgba(255,255,255,1)" class="Ellipse_9_c_Class" rx="10.5" ry="10.5" cx="10.5" cy="10.5"></ellipse></svg><span class="icon-info Icon_awesome_info_module_m_sidenav"></span></div>[[${module.link.module.name}]]</a></li>
</ul>
</div>
</div>
Expand Down Expand Up @@ -476,7 +476,7 @@ <h3 class="spaceName">
style="font-size: 20px; color: rgba(150, 45, 62, 1);"
th:onclick="openSpaceDescription()"></span>
<a sec:authorize="isAuthenticated()"
th:href="@{|/staff/space/${space.id}|}"><span
th:href="@{|/staff/space/${space?.id}|}"><span
style="display: inline-block; color: rgba(150, 45, 62, 1);">
<span class="icon-esit" style="display: inline-block;"></span></span></a>
</h3>
Expand All @@ -485,8 +485,8 @@ <h3 class="spaceName">
<div id="space">

<img
th:style="|max-width: ${space.image.width}px; border-radius: 13px; width: 100%;|"
id="bgImage" th:src="@{'/api/image/'+${space.image.id}}"/>
th:style="|max-width: ${space.image?.width}px; border-radius: 13px; width: 100%;|"
id="bgImage" th:src="@{'/api/image/'+${space.image?.id}}"/>
</div>
</div>
<div id="rightContent" th:if="${space.description!=NULL}">
Expand Down
2 changes: 1 addition & 1 deletion vspace/src/main/webapp/WEB-INF/views/layouts/main.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
Expand Down

0 comments on commit 35e8976

Please sign in to comment.