aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2023-01-12 14:57:32 +0300
committerGravatar Vitaly Takmazov2023-01-12 14:57:32 +0300
commitbdf1c3c33827abe277f8ecbbc07de710a1f05c89 (patch)
tree2403b1b3d99ddd9bc40b976ea6db5a73302d86aa
parente7e5432aba9ae4cdba8a546969de0618968f8b57 (diff)
Fix avatar update
-rw-r--r--src/main/java/com/juick/www/controllers/Settings.java6
-rw-r--r--src/main/resources/templates/views/settings_about.html2
2 files changed, 4 insertions, 4 deletions
diff --git a/src/main/java/com/juick/www/controllers/Settings.java b/src/main/java/com/juick/www/controllers/Settings.java
index 4d7deece..11371ced 100644
--- a/src/main/java/com/juick/www/controllers/Settings.java
+++ b/src/main/java/com/juick/www/controllers/Settings.java
@@ -92,7 +92,7 @@ public class Settings {
@ModelAttribute User visitor,
Locale locale,
@RequestParam(required = false, defaultValue = "main") String page,
- @RequestParam(required = false) String code, ModelMap model) throws IOException {
+ @RequestParam(required = false) String code, ModelMap model) {
visitor.setAvatar(webApp.getAvatarWebPath(visitor));
List<String> pages = Arrays.asList("main", "password", "about", "auth-email", "privacy");
if (!pages.contains(page)) {
@@ -128,7 +128,7 @@ public class Settings {
protected String doPost(
@ModelAttribute User visitor,
HttpServletRequest request, HttpServletResponse response,
- @RequestParam(required = false) MultipartFile avatar,
+ @RequestParam(required = false) MultipartFile newAvatar,
ModelMap model)
throws IOException {
if (visitor.isAnonymous()) {
@@ -166,7 +166,7 @@ public class Settings {
visitor.setCountry(request.getParameter("country"));
visitor.setUrl(request.getParameter("url"));
visitor.setDescription(request.getParameter("descr"));
- String avatarTmpPath = HttpUtils.receiveMultiPartFile(avatar, storageService.getTemporaryDirectory()).getHost();
+ String avatarTmpPath = HttpUtils.receiveMultiPartFile(newAvatar, storageService.getTemporaryDirectory()).getHost();
if (StringUtils.isNotEmpty(avatarTmpPath)) {
storageService.saveAvatar(avatarTmpPath, visitor);
}
diff --git a/src/main/resources/templates/views/settings_about.html b/src/main/resources/templates/views/settings_about.html
index 5e308671..ea906e0c 100644
--- a/src/main/resources/templates/views/settings_about.html
+++ b/src/main/resources/templates/views/settings_about.html
@@ -9,7 +9,7 @@
<p>About:<br/>
<input type="text" name="descr" value="{{ userinfo.description }}" style="width: 100%;"/><br/>
<small>Max. 255 symbols</small></p>
- <p>Avatar: <input type="file" name="avatar"/><br/>
+ <p>Avatar: <input type="file" name="newAvatar"/><br/>
<small>Recommendations: PNG, 96x96, &lt;50Kb. Also, JPG and GIF supported.</small></p>
<p><input type="hidden" name="page" value="about"/><input type="submit" value=" OK "/></p>
</form>