mirror of
https://github.com/tailscale/tailscale.git
synced 2025-10-08 23:49:56 +00:00
client/web: add advanced login options
This adds an expandable section of the login view to allow users to specify an auth key and an alternate control URL. Input and Collapsible components and accompanying styles were brought over from the adminpanel. Updates #10261 Signed-off-by: Will Norris <will@tailscale.com>
This commit is contained in:
@@ -790,10 +790,18 @@ func (s *Server) tailscaleUp(ctx context.Context, st *ipnstate.Status, opt tails
|
||||
|
||||
go func() {
|
||||
if !isRunning {
|
||||
s.lc.Start(ctx, ipn.Options{})
|
||||
ipnOptions := ipn.Options{AuthKey: opt.AuthKey}
|
||||
if opt.ControlURL != "" {
|
||||
ipnOptions.UpdatePrefs = &ipn.Prefs{ControlURL: opt.ControlURL}
|
||||
}
|
||||
if err := s.lc.Start(ctx, ipnOptions); err != nil {
|
||||
s.logf("start: %v", err)
|
||||
}
|
||||
}
|
||||
if opt.Reauthenticate {
|
||||
s.lc.StartLoginInteractive(ctx)
|
||||
if err := s.lc.StartLoginInteractive(ctx); err != nil {
|
||||
s.logf("startLogin: %v", err)
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
@@ -802,6 +810,9 @@ func (s *Server) tailscaleUp(ctx context.Context, st *ipnstate.Status, opt tails
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if n.State != nil && *n.State == ipn.Running {
|
||||
return "", nil
|
||||
}
|
||||
if n.ErrMessage != nil {
|
||||
msg := *n.ErrMessage
|
||||
return "", fmt.Errorf("backend error: %v", msg)
|
||||
@@ -816,6 +827,9 @@ type tailscaleUpOptions struct {
|
||||
// If true, force reauthentication of the client.
|
||||
// Otherwise simply reconnect, the same as running `tailscale up`.
|
||||
Reauthenticate bool
|
||||
|
||||
ControlURL string
|
||||
AuthKey string
|
||||
}
|
||||
|
||||
// serveTailscaleUp serves requests to /api/up.
|
||||
|
Reference in New Issue
Block a user