package com.example.testproject.models;
import com.example.testproject.services.LoggedUserInfoService;
import jakarta.annotation.PostConstruct;
import org.springframework.stereotype.Component;
import org.springframework.web.context.annotation.RequestScope;
@RequestScope
@Component
public class LoginProccesor {
private String username;
private String password;
private final LoggedUserInfoService loggedUserInfoService;
public LoginProccesor(LoggedUserInfoService loggedUserInfoService) {
this.loggedUserInfoService = loggedUserInfoService;
}
public boolean login(String username, String password) {
if (username.equals("mich") && password.equals("1234")){
loggedUserInfoService.setUsername(username);
return true;
}
else {
return false;
}
}
}
System.out.println(loginProccesor);