Skip to content

Commit 096074c

Browse files
authored
Set the hello world view as default route (#61)
Defines and registers a default route ("") in Vaadin. Also in this commit: * fix email validation exception leak to the log
1 parent 9ffe7b7 commit 096074c

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

webapp/frontend/generated/vaadin.ts

+2
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,7 @@ import './vaadin-featureflags.ts';
22

33
import './index';
44

5+
import '@vaadin/flow-frontend/VaadinDevmodeGizmo.js';
6+
57
import { applyTheme } from './theme';
68
applyTheme(document);

webapp/src/main/java/life/qbic/security/UserDetailsServiceImpl.java

+10-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import java.util.ArrayList;
44
import java.util.List;
55
import life.qbic.identityaccess.domain.user.EmailAddress;
6+
import life.qbic.identityaccess.domain.user.EmailAddress.EmailValidationException;
67
import life.qbic.identityaccess.domain.user.User;
78
import life.qbic.identityaccess.domain.user.UserRepository;
89
import org.springframework.beans.factory.annotation.Autowired;
@@ -24,7 +25,15 @@ public class UserDetailsServiceImpl implements UserDetailsService {
2425

2526
@Override
2627
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
27-
var user = userRepository.findByEmail(EmailAddress.from(username));
28+
EmailAddress email;
29+
// Check if the email address is valid
30+
try {
31+
email = EmailAddress.from(username);
32+
} catch (EmailValidationException e) {
33+
throw new UsernameNotFoundException("Cannot find user");
34+
}
35+
// Then search for a user with the provided email address
36+
var user = userRepository.findByEmail(email);
2837
return new QbicUserDetails(
2938
user.orElseThrow(() -> new UsernameNotFoundException("Cannot find user")));
3039
}

webapp/src/main/java/life/qbic/views/helloworld/HelloWorldView.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import org.springframework.beans.factory.annotation.Autowired;
1616

1717
@PageTitle("Hello World")
18-
@Route(value = "hello", layout = MainLayout.class)
18+
@Route(value = "", layout = MainLayout.class)
1919
@PermitAll
2020
public class HelloWorldView extends VerticalLayout {
2121

webapp/src/main/java/life/qbic/views/login/LoginHandler.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ private void addListener() {
8383

8484
private void onLoginSucceeded() {
8585
clearNotifications();
86-
UI.getCurrent().navigate("/hello");
86+
UI.getCurrent().navigate("/");
8787
}
8888

8989
@Override

0 commit comments

Comments
 (0)