Skip to content

Commit

Permalink
Fix typo
Browse files Browse the repository at this point in the history
Signed-off-by: William <[email protected]>
  • Loading branch information
kwesidev committed Dec 6, 2023
1 parent c737e64 commit 4997aac
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions internal/apiserver/api_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ func (ap *APIServer) Run() {
func (ap *APIServer) registerGlobalFunctions() {
authController := controllers.NewAuthController(ap.db)
http.HandleFunc("/api/auth/login", middlewares.Method("POST", authController.Login))
http.HandleFunc("/api/auth/passwordLessLogin", middlewares.Method("POST", authController.PasswordLessLogin))
http.HandleFunc("/api/auth/completePasswordLessLogin", middlewares.Method("POST", authController.CompletePasswordLessLogin))
http.HandleFunc("/api/auth/passwordLessLogin", middlewares.Method("POST", authController.PasswordlessLogin))
http.HandleFunc("/api/auth/completePasswordLessLogin", middlewares.Method("POST", authController.CompletePasswordlessLogin))
http.HandleFunc("/api/auth/tokenRefresh", middlewares.Method("POST", authController.RefreshToken))
http.HandleFunc("/api/auth/register", middlewares.Method("POST", authController.Register))
http.HandleFunc("/api/auth/passwordResetRequest", middlewares.Method("POST", authController.PasswordResetRequest))
Expand Down
6 changes: 3 additions & 3 deletions internal/controllers/auth_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (authCtrl *AuthController) Login(w http.ResponseWriter, r *http.Request) {
}

// Login Handler To Authenticate user without passsword
func (authCtrl *AuthController) PasswordLessLogin(w http.ResponseWriter, r *http.Request) {
func (authCtrl *AuthController) PasswordlessLogin(w http.ResponseWriter, r *http.Request) {
passwordLessAuthRequest := models.PasswordLessAuthRequest{}
err := utilities.GetJsonInput(&passwordLessAuthRequest, r)
if err != nil {
Expand All @@ -75,7 +75,7 @@ func (authCtrl *AuthController) PasswordLessLogin(w http.ResponseWriter, r *http
return
}
var passwordLessAuthResponse *models.PasswordLessAuthResponse
passwordLessAuthResponse, err = authCtrl.authService.PasswordLessLogin(passwordLessAuthRequest.Username, passwordLessAuthRequest.SendMethod, "", "")
passwordLessAuthResponse, err = authCtrl.authService.PasswordlessLogin(passwordLessAuthRequest.Username, passwordLessAuthRequest.SendMethod, "", "")
if err != nil {
if errors.Is(err, services.ErrorInvalidUsername) || errors.Is(err, services.ErrorInvalidPassword) || errors.Is(err, services.ErrorAccountNotActive) {
utilities.JSONError(w, err.Error(), http.StatusUnauthorized)
Expand All @@ -88,7 +88,7 @@ func (authCtrl *AuthController) PasswordLessLogin(w http.ResponseWriter, r *http
}

// Completes passwordless login
func (authCtrl *AuthController) CompletePasswordLessLogin(w http.ResponseWriter, r *http.Request) {
func (authCtrl *AuthController) CompletePasswordlessLogin(w http.ResponseWriter, r *http.Request) {
completePasswordLessLogin := models.CompletePasswordLessRequest{}
err := utilities.GetJsonInput(&completePasswordLessLogin, r)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/services/auth_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (authSrv *AuthService) generateAuthResponse(userDetails models.User, ipAddr
}

// Func loginByUsername this will send an otp to the user which then be verified
func (authSrv *AuthService) PasswordLessLogin(username, sendMethod, ipAddress, userAgent string) (*models.PasswordLessAuthResponse, error) {
func (authSrv *AuthService) PasswordlessLogin(username, sendMethod, ipAddress, userAgent string) (*models.PasswordLessAuthResponse, error) {
userDetails := authSrv.userService.GetByUsername(username)
if userDetails == nil {
return nil, ErrorInvalidUsername
Expand Down

0 comments on commit 4997aac

Please sign in to comment.