-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from Aam-Digital/email_otp_improvements
Added configurability, time-to-live and improved code generation
- Loading branch information
Showing
7 changed files
with
80 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,4 +23,5 @@ | |
hs_err_pid* | ||
.DS_Store | ||
target/* | ||
.idea | ||
.idea | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/main/java/com/mesutpiskin/keycloak/auth/email/EmailConstants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.mesutpiskin.keycloak.auth.email; | ||
|
||
import lombok.experimental.UtilityClass; | ||
|
||
@UtilityClass | ||
public class EmailConstants { | ||
public String CODE = "emailCode"; | ||
public String CODE_LENGTH = "length"; | ||
public String CODE_TTL = "ttl"; | ||
public int DEFAULT_LENGTH = 6; | ||
public int DEFAULT_TTL = 300; | ||
} |
2 changes: 1 addition & 1 deletion
2
src/main/resources/theme/email-code-theme/email/html/code-email.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<html> | ||
<body> | ||
${kcSanitize(msg("emailCodeBody", code))?no_esc} | ||
${kcSanitize(msg("emailCodeBody", code, ttl))?no_esc} | ||
</body> | ||
</html> |
2 changes: 1 addition & 1 deletion
2
src/main/resources/theme/email-code-theme/email/messages/messages_en.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
emailCodeSubject={0} access code | ||
emailCodeBody=Access code: {0} | ||
emailCodeBody=Access code: {0}.\n\nThis code will expire within {1} seconds. | ||
resendCode=Resend Code |
2 changes: 1 addition & 1 deletion
2
src/main/resources/theme/email-code-theme/email/text/code-email.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
<#ftl output_format="plainText"> | ||
${msg("emailCodeBody", code)} | ||
${msg("emailCodeBody", code, ttl)} |