Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions cmd/auth/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/json"
"fmt"
"os"
"time"

"github.com/mexcool/simplelogin-cli/internal/api"
intauth "github.com/mexcool/simplelogin-cli/internal/auth"
Expand Down Expand Up @@ -70,6 +71,7 @@ func runStatus(cmd *cobra.Command, args []string) error {
data["email"] = info.Email
data["is_premium"] = info.IsPremium
data["in_trial"] = info.InTrial
data["trial_end_timestamp"] = info.TrialEndTimestamp
data["key_source"] = source
data["key"] = intauth.MaskKey(key)
data["api_url"] = apiBase
Expand All @@ -91,5 +93,10 @@ func runStatus(cmd *cobra.Command, args []string) error {
}
fmt.Fprintf(os.Stderr, "Premium: %s\n", premium)

if info.InTrial && info.TrialEndTimestamp != nil {
trialEnd := time.Unix(*info.TrialEndTimestamp, 0).UTC().Format("2006-01-02")
fmt.Fprintf(os.Stderr, "Trial ends: %s\n", trialEnd)
}

return nil
}
13 changes: 7 additions & 6 deletions internal/api/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,13 @@ func HandleError(statusCode int, body []byte, action string) error {

// UserInfo represents user information.
type UserInfo struct {
Name string `json:"name"`
Email string `json:"email"`
IsPremium bool `json:"is_premium"`
InTrial bool `json:"in_trial"`
ProfilePicURL string `json:"profile_picture_url"`
MaxAliasFreePlan int `json:"max_alias_free_plan"`
Name string `json:"name"`
Email string `json:"email"`
IsPremium bool `json:"is_premium"`
InTrial bool `json:"in_trial"`
TrialEndTimestamp *int64 `json:"trial_end_timestamp"`
ProfilePicURL string `json:"profile_picture_url"`
MaxAliasFreePlan int `json:"max_alias_free_plan"`
}

// GetUserInfo retrieves the current user's information.
Expand Down
Loading