mirror of
https://github.com/headporter81/specialsource-homepage-backend.git
synced 2026-08-08 15:41:11 +09:00
nitial commit
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package company.specialsource.controller;
|
||||
|
||||
import company.specialsource.dto.LoginRequest;
|
||||
import company.specialsource.service.UserService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api")
|
||||
@RequiredArgsConstructor
|
||||
public class AuthController {
|
||||
|
||||
private final UserService userService;
|
||||
|
||||
@PostMapping("/login")
|
||||
public ResponseEntity<String> login(@RequestBody LoginRequest loginRequest) {
|
||||
boolean isSuccess = userService.login(loginRequest.getUsername(), loginRequest.getPassword());
|
||||
|
||||
if (isSuccess) {
|
||||
return ResponseEntity.ok("로그인 성공!");
|
||||
} else {
|
||||
return ResponseEntity.status(401).body("아이디 또는 비밀번호가 틀렸습니다.");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user