Commit 2e50893e2d138a0174ecc4f967885a56d8702635
1 parent
4beb22c7
1.
Showing
1 changed file
with
15 additions
and
0 deletions
src/main/java/com/bsth/controller/realcontrol/AdminUtilsController.java
| @@ -24,6 +24,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; | @@ -24,6 +24,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; | ||
| 24 | import org.slf4j.Logger; | 24 | import org.slf4j.Logger; |
| 25 | import org.slf4j.LoggerFactory; | 25 | import org.slf4j.LoggerFactory; |
| 26 | import org.springframework.beans.factory.annotation.Autowired; | 26 | import org.springframework.beans.factory.annotation.Autowired; |
| 27 | +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; | ||
| 27 | import org.springframework.web.bind.annotation.RequestMapping; | 28 | import org.springframework.web.bind.annotation.RequestMapping; |
| 28 | import org.springframework.web.bind.annotation.RequestParam; | 29 | import org.springframework.web.bind.annotation.RequestParam; |
| 29 | import org.springframework.web.bind.annotation.RestController; | 30 | import org.springframework.web.bind.annotation.RestController; |
| @@ -317,4 +318,18 @@ public class AdminUtilsController { | @@ -317,4 +318,18 @@ public class AdminUtilsController { | ||
| 317 | 318 | ||
| 318 | return "error"; | 319 | return "error"; |
| 319 | } | 320 | } |
| 321 | + | ||
| 322 | + public static void main(String[] args) { | ||
| 323 | + String line = "724380,Dwj@1212"; | ||
| 324 | + String[] arr = line.split(","); | ||
| 325 | + if (arr.length == 2) { | ||
| 326 | + String uname = arr[0], password = arr[1]; | ||
| 327 | + StringBuilder sb = new StringBuilder("update bsth_c_sys_user set password='"); | ||
| 328 | + sb.append(new BCryptPasswordEncoder(4).encode(password)); | ||
| 329 | + sb.append("' where user_name='"); | ||
| 330 | + sb.append(uname); | ||
| 331 | + sb.append("';"); | ||
| 332 | + System.out.println(sb.toString()); | ||
| 333 | + } | ||
| 334 | + } | ||
| 320 | } | 335 | } |
| 321 | \ No newline at end of file | 336 | \ No newline at end of file |