Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

many: setup snapd macaroon for local users #2051

Merged
merged 4 commits into from
Oct 3, 2016
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Minor refactoring to avoid duplication
  • Loading branch information
matiasb committed Oct 3, 2016
commit e7fdb16a3458f1c8b5421d99fe6a08f1c3ddb85f
11 changes: 4 additions & 7 deletions daemon/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,15 +302,12 @@ func loginUser(c *Command, r *http.Request, user *auth.UserState) Response {
// local user logged-in, set its store macaroons
user.StoreMacaroon = macaroon
user.StoreDischarges = []string{discharge}
err := auth.UpdateUser(state, user)
if err != nil {
return InternalError("cannot persist authentication details: %v", err)
}
err = auth.UpdateUser(state, user)
} else {
_, err = auth.NewUser(state, loginData.Username, loginData.Email, macaroon, []string{discharge})
if err != nil {
return InternalError("cannot persist authentication details: %v", err)
}
}
if err != nil {
return InternalError("cannot persist authentication details: %v", err)
}
state.Unlock()

Expand Down