Skip to content

Commit da8beca

Browse files
committed
Merge branch 'develop' of https://github.com/CodeChillAlluna/code-chill into develop
2 parents 7b800b1 + 429d5ce commit da8beca

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/spring/src/main/java/fr/codechill/spring/rest/UserController.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import org.springframework.beans.factory.annotation.Autowired;
99
import org.springframework.web.bind.annotation.CrossOrigin;
1010
import org.springframework.web.bind.annotation.GetMapping;
11+
import org.springframework.web.bind.annotation.DeleteMapping;
1112
import org.springframework.web.bind.annotation.PathVariable;
1213
import org.springframework.web.bind.annotation.PostMapping;
1314
import 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)) {

0 commit comments

Comments
 (0)