Polish hellojs Sample

- Apply timestamp to composed messages
- Remove unnecessary $.map call
- Add password encoder prefix to password

Fixes gh-8555
Fixes gh-8556
This commit is contained in:
Josh Cummings 2020-05-19 12:19:03 -06:00
parent b04b34ba85
commit c519d726ed
No known key found for this signature in database
GPG Key ID: 49EF60DD7FF83443
3 changed files with 4 additions and 3 deletions

View File

@ -28,7 +28,7 @@ public class SecurityConfig {
AuthenticationManagerBuilder auth) throws Exception {
auth
.inMemoryAuthentication()
.withUser("user").password("password").roles("USER");
.withUser("user").password("{noop}password").roles("USER");
}
// @formatter:on
}

View File

@ -16,6 +16,7 @@
package org.springframework.security.samples.mvc;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Optional;
@ -67,6 +68,7 @@ public class MessageJsonController {
}
return new ResponseEntity<>(errors, HttpStatus.BAD_REQUEST);
}
message.setCreated(Calendar.getInstance());
message = messageRepository.save(message);
return new ResponseEntity<>(message, HttpStatus.OK);
}

View File

@ -40,8 +40,7 @@ function MessageListViewModel() {
$.ajax("./", {
data: ko.toJSON(self.compose),
type: "post", contentType: "application/json",
success: function(result) {
$.map(result, function(item) { return new Message(item) });
success: function() {
self.goToInbox();
}
});