Skip to content

Commit 08fd602

Browse files
committed
chore(be): remove unused code
1 parent 2783f9c commit 08fd602

File tree

6 files changed

+18
-258
lines changed

6 files changed

+18
-258
lines changed

api/auth.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@ package api
22

33
import (
44
"errors"
5+
"net/http"
6+
"strings"
7+
"time"
8+
59
"github.com/pquerna/otp"
610
"github.com/semaphoreui/semaphore/api/helpers"
711
"github.com/semaphoreui/semaphore/db"
12+
proApi "github.com/semaphoreui/semaphore/pro/api"
813
"github.com/semaphoreui/semaphore/util"
914
log "github.com/sirupsen/logrus"
10-
"net/http"
11-
"strings"
12-
"time"
1315

1416
"github.com/pquerna/otp/totp"
1517
)
@@ -160,7 +162,7 @@ func verifySession(w http.ResponseWriter, r *http.Request) {
160162

161163
switch session.VerificationMethod {
162164
case db.SessionVerificationEmail:
163-
verifySessionByEmail(session, w, r)
165+
proApi.VerifySessionByEmail(session, w, r)
164166
return
165167

166168
case db.SessionVerificationTotp:

api/auth_verify.go

Lines changed: 0 additions & 144 deletions
This file was deleted.

api/login.go

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -158,21 +158,6 @@ func createSession(w http.ResponseWriter, r *http.Request, user db.User, oidc bo
158158
switch {
159159
case user.Totp != nil && util.Config.Auth.Totp.Enabled:
160160
verificationMethod = db.SessionVerificationTotp
161-
162-
case util.Config.Auth.Email.Enabled && (!util.Config.Auth.Email.DisableForOidc || !oidc):
163-
164-
err = newEmailOtp(user.ID, user.Email, helpers.Store(r))
165-
166-
if err != nil {
167-
log.WithError(err).WithFields(log.Fields{
168-
"user_id": user.ID,
169-
"context": "session",
170-
}).Error("Failed to add email otp verification")
171-
helpers.WriteErrorStatus(w, "Failed to create email OTP verification", http.StatusInternalServerError)
172-
return
173-
}
174-
175-
verificationMethod = db.SessionVerificationEmail
176161
default:
177162
verificationMethod = db.SessionVerificationNone
178163
verified = true

api/login_email.go

Lines changed: 0 additions & 92 deletions
This file was deleted.

api/router.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,6 @@ func Route(
146146
publicAPIRouter.Use(StoreMiddleware, JSONMiddleware)
147147

148148
publicAPIRouter.HandleFunc("/auth/login", login).Methods("GET", "POST")
149-
publicAPIRouter.HandleFunc("/auth/verify/email", startEmailVerification).Methods("POST")
150-
publicAPIRouter.HandleFunc("/auth/login/email", loginEmail).Methods("GET", "POST")
151-
publicAPIRouter.HandleFunc("/auth/login/email/resend", resendEmailOtp).Methods("GET", "POST")
152149
publicAPIRouter.HandleFunc("/auth/verify", verifySession).Methods("POST")
153150
publicAPIRouter.HandleFunc("/auth/recovery", recoverySession).Methods("POST")
154151

pro/api/auth_verify.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package api
2+
3+
import (
4+
"net/http"
5+
6+
"github.com/semaphoreui/semaphore/db"
7+
)
8+
9+
func VerifySessionByEmail(session *db.Session, w http.ResponseWriter, r *http.Request) {
10+
w.WriteHeader(http.StatusForbidden)
11+
return
12+
}

0 commit comments

Comments
 (0)