File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
src/spring/src/main/java/fr/codechill/spring/rest Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 88import org .springframework .beans .factory .annotation .Autowired ;
99import org .springframework .web .bind .annotation .CrossOrigin ;
1010import org .springframework .web .bind .annotation .GetMapping ;
11+ import org .springframework .web .bind .annotation .DeleteMapping ;
1112import org .springframework .web .bind .annotation .PathVariable ;
1213import org .springframework .web .bind .annotation .PostMapping ;
1314import org .springframework .web .bind .annotation .PutMapping ;
@@ -48,6 +49,14 @@ public User getUser(@PathVariable("id") Long id) {
4849 return user ;
4950 }
5051
52+
53+ @ DeleteMapping ("/user/{id}" )
54+ public Boolean deleteUser (@ PathVariable ("id" ) Long id ) {
55+ User user = this .urepo .findOne (id );
56+ this .urepo .delete (user );
57+ return true ;
58+ }
59+
5160 @ PutMapping ("/user/{id}" )
5261 public User editUser (@ RequestBody User user ) {
5362 this .urepo .save (user );
@@ -91,8 +100,8 @@ public ResponseEntity<?> resetPassword(@PathVariable("token") String token) {
91100 Date currentDate = new Date ();
92101 Calendar c = Calendar .getInstance ();
93102 c .setTime (user .getLastPasswordResetDate ());
94- Date currentDatePlusOne = c .getTime ();
95103 c .add (Calendar .DATE , 1 );
104+ Date currentDatePlusOne = c .getTime ();
96105
97106 if (user != null ) {
98107 if (currentDate .after (user .getLastPasswordResetDate ()) && currentDate .before (currentDatePlusOne )) {
You can’t perform that action at this time.
0 commit comments