mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 01:18:42 +00:00
parent
fdb3c55562
commit
146ee18c62
2 changed files with 12 additions and 1 deletions
|
|
@ -96,6 +96,17 @@ type permissionError struct {
|
|||
badArgs []invalidArgument
|
||||
}
|
||||
|
||||
func newPermissionError(name, reason string) permissionError {
|
||||
return permissionError{
|
||||
badArgs: []invalidArgument{
|
||||
invalidArgument{
|
||||
name: name,
|
||||
reason: reason,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (e permissionError) Error() string {
|
||||
switch len(e.badArgs) {
|
||||
case 0:
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ func (svc service) modifyEmailAddress(ctx context.Context, user *kolide.User, em
|
|||
if password != nil {
|
||||
err := user.ValidatePassword(*password)
|
||||
if err != nil {
|
||||
return permissionError{message: "incorrect password"}
|
||||
return newPermissionError("password", "incorrect password")
|
||||
}
|
||||
}
|
||||
random, err := kolide.RandomText(svc.config.App.TokenKeySize)
|
||||
|
|
|
|||
Loading…
Reference in a new issue