Skip to content

Commit

Permalink
update to include ip in agent login failed error
Browse files Browse the repository at this point in the history
  • Loading branch information
sagostin committed Sep 20, 2024
1 parent fe0a114 commit 971ed3b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ func (r *AgentLogin) AgentLogin(ip string, db *mongo.Database) (string, error) {
ee := internal.ErrorFormat{Package: "internal.auth", Level: log.ErrorLevel, Function: "auth.AgentLogin"}

if r.PIN == "" {
ee.Message = "unable to create session"
ee.Message = "invalid pin"
return "", ee.ToError()
}

Expand All @@ -230,12 +230,14 @@ func (r *AgentLogin) AgentLogin(ip string, db *mongo.Database) (string, error) {
if err != nil {
ee.Error = err
ee.Message = "error getting agent"
ee.Message += " - connecting ip: " + ip
return "", ee.ToError()
}

if u.Pin != r.PIN {
ee.Error = err
ee.Message = "pins do not match"
ee.Message += " - connecting ip: " + ip
return "", ee.ToError()
}

Expand All @@ -249,6 +251,7 @@ func (r *AgentLogin) AgentLogin(ip string, db *mongo.Database) (string, error) {
if err != nil {
ee.Error = err
ee.Message = "unable to create session"
ee.Message += " - connecting ip: " + ip
return "", ee.ToError()
}

Expand Down

0 comments on commit 971ed3b

Please sign in to comment.