mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 17:05:18 +00:00
9465434826
* Change email functionality * Code review changes for @groob * Name change per @groob * Code review changes per @marpaia Also added addition non-happy path tests to satisfy concerns by @groob
23 lines
531 B
Go
23 lines
531 B
Go
package service
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
|
|
"golang.org/x/net/context"
|
|
)
|
|
|
|
func (mw metricsMiddleware) ChangeUserEmail(ctx context.Context, token string) (string, error) {
|
|
var (
|
|
err error
|
|
newEmail string
|
|
)
|
|
defer func(begin time.Time) {
|
|
lvs := []string{"method", "CommitEmailChange", "error", fmt.Sprint(err != nil)}
|
|
mw.requestCount.With(lvs...).Add(1)
|
|
mw.requestLatency.With(lvs...).Observe(time.Since(begin).Seconds())
|
|
}(time.Now())
|
|
newEmail, err = mw.Service.ChangeUserEmail(ctx, token)
|
|
return newEmail, err
|
|
}
|