mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-07-04 09:42:29 +00:00
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:
parent
b04b34ba85
commit
c519d726ed
@ -28,7 +28,7 @@ public class SecurityConfig {
|
|||||||
AuthenticationManagerBuilder auth) throws Exception {
|
AuthenticationManagerBuilder auth) throws Exception {
|
||||||
auth
|
auth
|
||||||
.inMemoryAuthentication()
|
.inMemoryAuthentication()
|
||||||
.withUser("user").password("password").roles("USER");
|
.withUser("user").password("{noop}password").roles("USER");
|
||||||
}
|
}
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
package org.springframework.security.samples.mvc;
|
package org.springframework.security.samples.mvc;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Calendar;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@ -67,6 +68,7 @@ public class MessageJsonController {
|
|||||||
}
|
}
|
||||||
return new ResponseEntity<>(errors, HttpStatus.BAD_REQUEST);
|
return new ResponseEntity<>(errors, HttpStatus.BAD_REQUEST);
|
||||||
}
|
}
|
||||||
|
message.setCreated(Calendar.getInstance());
|
||||||
message = messageRepository.save(message);
|
message = messageRepository.save(message);
|
||||||
return new ResponseEntity<>(message, HttpStatus.OK);
|
return new ResponseEntity<>(message, HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
@ -40,8 +40,7 @@ function MessageListViewModel() {
|
|||||||
$.ajax("./", {
|
$.ajax("./", {
|
||||||
data: ko.toJSON(self.compose),
|
data: ko.toJSON(self.compose),
|
||||||
type: "post", contentType: "application/json",
|
type: "post", contentType: "application/json",
|
||||||
success: function(result) {
|
success: function() {
|
||||||
$.map(result, function(item) { return new Message(item) });
|
|
||||||
self.goToInbox();
|
self.goToInbox();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user