Skip to content

Commit

Permalink
[Hexlet#159] fix build, login page
Browse files Browse the repository at this point in the history
  • Loading branch information
d1z3d committed Jun 28, 2024
1 parent b50fda8 commit 8896a27
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
12 changes: 12 additions & 0 deletions src/main/java/io/hexlet/typoreporter/config/SecurityConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.NoOpPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.oauth2.client.registration.ClientRegistration;
import org.springframework.security.oauth2.client.registration.ClientRegistrationRepository;
import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.access.AccessDeniedHandler;
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
Expand Down Expand Up @@ -123,6 +125,16 @@ public SecurityFilterChain filterChain(HttpSecurity http,
return http.build();
}

@Bean
public ClientRegistrationRepository getClientRegistrationRepository() {
return new ClientRegistrationRepository() {
@Override
public ClientRegistration findByRegistrationId(String registrationId) {
return null;
}
};
}

@Bean
public AuthenticationSuccessHandler getOAuth2SuccessHandler() {
return new OAuth2SuccessHandler();
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/messages_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,4 @@ btn.delete-from-wks=Delete from workspace

alert.password-wrong-format=Password must be between 8 and 20 characters \
and contain only latin letters, digits and symbols ~`!@#$%^&*()_-+={[}]|\:;"'<,>.?/
link.sign-in-with-github=Sign in with GitHub
1 change: 1 addition & 0 deletions src/main/resources/messages_ru.properties
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,4 @@ text.wks-delete-confirm=Удалить пространство?
alert.password-wrong-format=Пароль должен быть от 8 до 20 символов\
\ и содержать только буквы латинского алфавита,\
\ цифры и символы ~`!@#$%^&*()_-+={[}]|\:;"'<,>.?/
link.sign-in-with-github=Войти с помощью: GitHub
5 changes: 2 additions & 3 deletions src/main/resources/templates/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@
<button class="btn btn-primary" type="submit" th:text="#{btn.login}"></button>
</form>
</div>
<div class="container unauthenticated">
With GitHub: <a href="/oauth2/authorization/github">click here</a>
</div>
</div>
<div class="row">
<div class="mt-4">
<a class="link-primary" th:href="@{/signup}" th:text="#{link.signup}"></a>
<br>
<a class="link-primary" href="/oauth2/authorization/github" th:text="#{link.sign-in-with-github}"></a>
</div>
</div>
</main>
Expand Down

0 comments on commit 8896a27

Please sign in to comment.