Added error logging to account activation handler (#1647)

This commit is contained in:
Yaroslav Vorobiov 2019-04-09 15:20:29 +03:00 committed by Egon Elbre
parent a3caa8e00d
commit 2218793c55
2 changed files with 12 additions and 0 deletions

View File

@ -78,11 +78,19 @@ func rootMutation(log *zap.Logger, service *console.Service, mailService *mailse
return nil, err
}
log.Error("register: failed to parse secret",
zap.String("rawSecret", secretInput),
zap.Error(err))
user, err := service.CreateUser(p.Context, createUser, secret)
if err != nil {
return nil, err
}
log.Error("register: failed to create account",
zap.String("rawSecret", secretInput),
zap.Error(err))
token, err := service.GenerateActivationToken(p.Context, user.ID, user.Email)
if err != nil {
log.Error("register: failed to generate activation token",

View File

@ -152,6 +152,10 @@ func (s *Server) accountActivationHandler(w http.ResponseWriter, req *http.Reque
err := s.service.ActivateAccount(context.Background(), activationToken)
if err != nil {
s.log.Error("activation: failed to activate account",
zap.String("token", activationToken),
zap.Error(err))
http.ServeFile(w, req, filepath.Join(s.config.StaticDir, "static", "errors", "404.html"))
return
}