Skip to content

Commit bef99d4

Browse files
authored
[client] Rename logout to deregister (#4307)
1 parent 9e95841 commit bef99d4

File tree

2 files changed

+21
-20
lines changed

2 files changed

+21
-20
lines changed

client/cmd/logout.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ import (
1212
)
1313

1414
var logoutCmd = &cobra.Command{
15-
Use: "logout",
16-
Short: "logout from the NetBird Management Service and delete peer",
15+
Use: "deregister",
16+
Aliases: []string{"logout"},
17+
Short: "deregister from the NetBird Management Service and delete peer",
1718
RunE: func(cmd *cobra.Command, args []string) error {
1819
SetFlagsFromEnvVars(rootCmd)
1920

@@ -44,10 +45,10 @@ var logoutCmd = &cobra.Command{
4445
}
4546

4647
if _, err := daemonClient.Logout(ctx, req); err != nil {
47-
return fmt.Errorf("logout: %v", err)
48+
return fmt.Errorf("deregister: %v", err)
4849
}
4950

50-
cmd.Println("Logged out successfully")
51+
cmd.Println("Deregistered successfully")
5152
return nil
5253
},
5354
}

client/ui/profile.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func (s *serviceClient) showProfilesUI() {
4646
widget.NewLabel(""), // profile name
4747
layout.NewSpacer(),
4848
widget.NewButton("Select", nil),
49-
widget.NewButton("Logout", nil),
49+
widget.NewButton("Deregister", nil),
5050
widget.NewButton("Remove", nil),
5151
)
5252
},
@@ -128,7 +128,7 @@ func (s *serviceClient) showProfilesUI() {
128128
}
129129

130130
logoutBtn.Show()
131-
logoutBtn.SetText("Logout")
131+
logoutBtn.SetText("Deregister")
132132
logoutBtn.OnTapped = func() {
133133
s.handleProfileLogout(profile.Name, refresh)
134134
}
@@ -143,7 +143,7 @@ func (s *serviceClient) showProfilesUI() {
143143
if !confirm {
144144
return
145145
}
146-
146+
147147
err = s.removeProfile(profile.Name)
148148
if err != nil {
149149
log.Errorf("failed to remove profile: %v", err)
@@ -334,44 +334,44 @@ func (s *serviceClient) getProfiles() ([]Profile, error) {
334334

335335
func (s *serviceClient) handleProfileLogout(profileName string, refreshCallback func()) {
336336
dialog.ShowConfirm(
337-
"Logout",
338-
fmt.Sprintf("Are you sure you want to logout from '%s'?", profileName),
337+
"Deregister",
338+
fmt.Sprintf("Are you sure you want to deregister from '%s'?", profileName),
339339
func(confirm bool) {
340340
if !confirm {
341341
return
342342
}
343-
343+
344344
conn, err := s.getSrvClient(defaultFailTimeout)
345345
if err != nil {
346346
log.Errorf("failed to get service client: %v", err)
347347
dialog.ShowError(fmt.Errorf("failed to connect to service"), s.wProfiles)
348348
return
349349
}
350-
350+
351351
currUser, err := user.Current()
352352
if err != nil {
353353
log.Errorf("failed to get current user: %v", err)
354354
dialog.ShowError(fmt.Errorf("failed to get current user"), s.wProfiles)
355355
return
356356
}
357-
357+
358358
username := currUser.Username
359359
_, err = conn.Logout(s.ctx, &proto.LogoutRequest{
360360
ProfileName: &profileName,
361361
Username: &username,
362362
})
363363
if err != nil {
364364
log.Errorf("logout failed: %v", err)
365-
dialog.ShowError(fmt.Errorf("logout failed"), s.wProfiles)
365+
dialog.ShowError(fmt.Errorf("deregister failed"), s.wProfiles)
366366
return
367367
}
368-
368+
369369
dialog.ShowInformation(
370-
"Logged Out",
371-
fmt.Sprintf("Successfully logged out from '%s'", profileName),
370+
"Deregistered",
371+
fmt.Sprintf("Successfully deregistered from '%s'", profileName),
372372
s.wProfiles,
373373
)
374-
374+
375375
refreshCallback()
376376
},
377377
s.wProfiles,
@@ -602,7 +602,7 @@ func (p *profileMenu) refresh() {
602602

603603
// Add Logout menu item
604604
ctx2, cancel2 := context.WithCancel(context.Background())
605-
logoutItem := p.profileMenuItem.AddSubMenuItem("Logout", "")
605+
logoutItem := p.profileMenuItem.AddSubMenuItem("Deregister", "")
606606
p.logoutSubItem = &subItem{logoutItem, ctx2, cancel2}
607607

608608
go func() {
@@ -616,9 +616,9 @@ func (p *profileMenu) refresh() {
616616
}
617617
if err := p.eventHandler.logout(p.ctx); err != nil {
618618
log.Errorf("logout failed: %v", err)
619-
p.app.SendNotification(fyne.NewNotification("Error", "Failed to logout"))
619+
p.app.SendNotification(fyne.NewNotification("Error", "Failed to deregister"))
620620
} else {
621-
p.app.SendNotification(fyne.NewNotification("Success", "Logged out successfully"))
621+
p.app.SendNotification(fyne.NewNotification("Success", "Deregistered successfully"))
622622
}
623623
}
624624
}

0 commit comments

Comments
 (0)