[skip_changelog] Update error message for sign-in source capitalization issue for OAuth (#7004)

This commit is contained in:
Abhijeet 2021-08-31 16:13:21 +05:30 committed by GitHub
parent 5dd083665c
commit 3414195b69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,6 +4,7 @@ import com.appsmith.server.domains.LoginSource;
import com.appsmith.server.exceptions.AppsmithError;
import com.appsmith.server.repositories.UserRepository;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.WordUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.InternalAuthenticationServiceException;
import org.springframework.security.core.userdetails.ReactiveUserDetailsService;
@ -49,7 +50,9 @@ public class CustomFormLoginServiceImpl implements ReactiveUserDetailsService {
// We can have a implementation to give which login method user should use but this will
// expose the sign-in source for external world and in turn to spammers
throw new InternalAuthenticationServiceException(
AppsmithError.INVALID_LOGIN_METHOD.getMessage(user.getSource().toString())
AppsmithError.INVALID_LOGIN_METHOD.getMessage(
WordUtils.capitalize(user.getSource().toString().toLowerCase())
)
);
}
return user;