Skip to content

Commit 9b959be

Browse files
committed
Show username in settings if email is empty
1 parent 870c03d commit 9b959be

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tmc-plugin/src/fi/helsinki/cs/tmc/ui/PreferencesPanel.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,15 @@
5050

5151
private void updateFields() {
5252
final Optional<String> email = this.settings.getEmail();
53+
final Optional<String> username = this.settings.getUsername();
5354
final JLabel login = this.loginLabel;
5455
final JButton logout = this.logoutButton;
55-
if (email.isPresent()) {
56+
if (email.isPresent() && !email.get().isEmpty()) {
5657
login.setText("Logged in as " + email.get());
5758
logout.setEnabled(true);
59+
} else if (username.isPresent()) {
60+
login.setText("Logged in as " + username.get());
61+
logout.setEnabled(true);
5862
} else {
5963
login.setText("Not logged in!");
6064
logout.setEnabled(false);

0 commit comments

Comments
 (0)