Browse Source

fix user auth for writeas posting

pull/36/head
Rob Loranger 4 years ago
parent
commit
96f57d52e8
No known key found for this signature in database GPG Key ID: D6F1633A4F0903B8
2 changed files with 4 additions and 1 deletions
  1. +1
    -1
      api/api.go
  2. +3
    -0
      config/user.go

+ 1
- 1
api/api.go View File

@@ -106,7 +106,7 @@ func DoPost(c *cli.Context, post []byte, font string, encrypt, code bool) (*writ
}

u, _ := config.LoadUser(c)
if u != nil && c.App.Name == "wf" {
if u != nil {
cl.SetToken(u.AccessToken)
} else {
return nil, fmt.Errorf("Not currently logged in. Authenticate with: " + executable.Name() + " auth <username>")


+ 3
- 0
config/user.go View File

@@ -136,6 +136,9 @@ func UserHostDir(c *cli.Context) (string, error) {
// CurrentUser returns the username of the user taking action in the current
// cli.Context.
func CurrentUser(c *cli.Context) (string, error) {
if c.App.Name == "writeas" {
return "user", nil
}
// Use user flag value
if c.GlobalString("user") != "" {
return c.GlobalString("user"), nil


Loading…
Cancel
Save