mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-22 07:15:25 +00:00
fix the verification emails (#366)
* fix the verification emails * fix typo * switch to token only
This commit is contained in:
@@ -17,12 +17,31 @@ func getStoreKeyPrefix(ctx context.Context) string {
|
||||
return getStoreKeyPrefixForTenent(tenantId)
|
||||
}
|
||||
|
||||
func getStoreKeyPrefixForTenent(tenantID string) string {
|
||||
tid := strings.Replace(strings.Replace(tenantID, "/", "_", -1), "-", "_", -1)
|
||||
func getTenantKey(ctx context.Context) string {
|
||||
tenantId, ok := tenant.FromContext(ctx)
|
||||
if !ok {
|
||||
tenantId = "micro"
|
||||
}
|
||||
|
||||
return strings.Replace(strings.Replace(tenantId, "/", "_", -1), "-", "_", -1)
|
||||
}
|
||||
|
||||
func getStoreKeyPrefixForTenent(tenantId string) string {
|
||||
tid := strings.Replace(strings.Replace(tenantId, "/", "_", -1), "-", "_", -1)
|
||||
|
||||
return fmt.Sprintf("user/%s/", tid)
|
||||
}
|
||||
|
||||
func generateAccountTenantKey(tenantId, userId string) string {
|
||||
return fmt.Sprintf("%saccount/id/%s", getStoreKeyPrefixForTenent(tenantId), userId)
|
||||
}
|
||||
func generateAccountTenantEmailKey(tenantId, email string) string {
|
||||
return fmt.Sprintf("%sacccount/email/%s", getStoreKeyPrefixForTenent(tenantId), email)
|
||||
}
|
||||
func generateAccountTenantUsernameKey(tenantId, username string) string {
|
||||
return fmt.Sprintf("%saccount/username/%s", getStoreKeyPrefixForTenent(tenantId), username)
|
||||
}
|
||||
|
||||
func generateAccountStoreKey(ctx context.Context, userId string) string {
|
||||
return fmt.Sprintf("%saccount/id/%s", getStoreKeyPrefix(ctx), userId)
|
||||
}
|
||||
@@ -47,6 +66,6 @@ func generateSessionStoreKey(ctx context.Context, sessionId string) string {
|
||||
return fmt.Sprintf("%ssession/%s", getStoreKeyPrefix(ctx), sessionId)
|
||||
}
|
||||
|
||||
func generateVerificationsTokenStoreKey(ctx context.Context, userId, token string) string {
|
||||
return fmt.Sprintf("%sverification-token/%s-%s", getStoreKeyPrefix(ctx), userId, token)
|
||||
func generateVerificationTokenStoreKey(token string) string {
|
||||
return fmt.Sprintf("user/verification-token/%s", token)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user