[server]fix: error redirection for email verification
This commit is contained in:
@@ -82,7 +82,7 @@ func GetOrganization() map[string]interface{} {
|
||||
|
||||
// GetForgotPasswordURL to get url for given token and hostname
|
||||
func GetForgotPasswordURL(token, redirectURI string) string {
|
||||
verificationURL := redirectURI + "?token=" + token
|
||||
verificationURL := redirectURI + "?token=" + token + "&redirect_uri=" + redirectURI
|
||||
return verificationURL
|
||||
}
|
||||
|
||||
@@ -92,6 +92,6 @@ func GetInviteVerificationURL(verificationURL, token, redirectURI string) string
|
||||
}
|
||||
|
||||
// GetEmailVerificationURL to get url for invite email verification
|
||||
func GetEmailVerificationURL(token, hostname string) string {
|
||||
return hostname + "/verify_email?token=" + token
|
||||
func GetEmailVerificationURL(token, hostname, redirectURI string) string {
|
||||
return hostname + "/verify_email?token=" + token + "&redirect_uri=" + redirectURI
|
||||
}
|
||||
|
17
server/utils/response.go
Normal file
17
server/utils/response.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// HandleRedirectORJsonResponse handles the response based on redirectURL
|
||||
func HandleRedirectORJsonResponse(c *gin.Context, httpResponse int, response map[string]interface{}, redirectURL string) {
|
||||
if strings.TrimSpace(redirectURL) == "" {
|
||||
c.JSON(httpResponse, response)
|
||||
} else {
|
||||
c.Redirect(http.StatusTemporaryRedirect, redirectURL)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user