Skip to content

Commit

Permalink
Fix code quality issues (gophish#2118)
Browse files Browse the repository at this point in the history
  • Loading branch information
withshubh authored Feb 24, 2021
1 parent e6533e9 commit 15303e3
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions controllers/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ func (as *AdminServer) nextOrIndex(w http.ResponseWriter, r *http.Request) {
next = path
}
}
http.Redirect(w, r, next, 302)
http.Redirect(w, r, next, http.StatusFound)
}

func (as *AdminServer) handleInvalidLogin(w http.ResponseWriter, r *http.Request, message string) {
Expand Down Expand Up @@ -386,7 +386,7 @@ func (as *AdminServer) Login(w http.ResponseWriter, r *http.Request) {
as.handleInvalidLogin(w, r, "Invalid Username/Password")
return
}
if u.AccountLocked == true {
if u.AccountLocked {
as.handleInvalidLogin(w, r, "Account Locked")
return
}
Expand Down
2 changes: 1 addition & 1 deletion imap/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func checkForNewEmails(im models.IMAP) {
log.Error("Error updating GoPhish email with rid ", rid, ": ", err.Error())
continue
}
if im.DeleteReportedCampaignEmail == true {
if im.DeleteReportedCampaignEmail {
deleteEmails = append(deleteEmails, m.SeqNum)
}
}
Expand Down
2 changes: 1 addition & 1 deletion middleware/ratelimit/ratelimit.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (limiter *PostLimiter) Cleanup() {
limiter.Lock()
defer limiter.Unlock()
for ip, bucket := range limiter.visitors {
if time.Now().Sub(bucket.lastSeen) >= limiter.expiry {
if time.Since(bucket.lastSeen) >= limiter.expiry {
delete(limiter.visitors, ip)
}
}
Expand Down
2 changes: 1 addition & 1 deletion models/email_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func (s *EmailRequest) Generate(msg *gomail.Message) error {
log.Error(err)
}
// don't set the Subject header if it is blank
if len(subject) != 0 {
if subject != "" {
msg.SetHeader("Subject", subject)
}

Expand Down
2 changes: 1 addition & 1 deletion models/maillog.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ func (m *MailLog) Generate(msg *gomail.Message) error {
log.Warn(err)
}
// don't set Subject header if the subject is empty
if len(subject) != 0 {
if subject != "" {
msg.SetHeader("Subject", subject)
}

Expand Down

0 comments on commit 15303e3

Please sign in to comment.