Mhamdans17 commited on
Commit ·
1d04fbb
1
Parent(s): c587f34
feat: customize WhatsApp OTP notification message for Reset Password
Browse files- controllers/auth_controller.go +1 -1
- services/whatsapp.go +16 -0
controllers/auth_controller.go
CHANGED
|
@@ -420,7 +420,7 @@ func ForgotPassword(c *gin.Context) {
|
|
| 420 |
}
|
| 421 |
|
| 422 |
// Kirim Notifikasi OTP Reset Password via WA
|
| 423 |
-
go services.
|
| 424 |
|
| 425 |
c.JSON(http.StatusOK, gin.H{
|
| 426 |
"status": "success",
|
|
|
|
| 420 |
}
|
| 421 |
|
| 422 |
// Kirim Notifikasi OTP Reset Password via WA
|
| 423 |
+
go services.SendResetPasswordOtpWa(req.Phone, code)
|
| 424 |
|
| 425 |
c.JSON(http.StatusOK, gin.H{
|
| 426 |
"status": "success",
|
services/whatsapp.go
CHANGED
|
@@ -146,6 +146,22 @@ func SendOtpWa(phone string, otpCode string) bool {
|
|
| 146 |
return postFonnte(formattedPhone, message)
|
| 147 |
}
|
| 148 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 149 |
func SendApprovalWa(phone string, storeName string, email string) bool {
|
| 150 |
if config.GlobalConfig.FonnteToken == "" || phone == "" {
|
| 151 |
return false
|
|
|
|
| 146 |
return postFonnte(formattedPhone, message)
|
| 147 |
}
|
| 148 |
|
| 149 |
+
func SendResetPasswordOtpWa(phone string, otpCode string) bool {
|
| 150 |
+
if config.GlobalConfig.FonnteToken == "" {
|
| 151 |
+
return false
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
formattedPhone := formatPhone(phone)
|
| 155 |
+
storeName := config.GlobalConfig.StoreName
|
| 156 |
+
if storeName == "" {
|
| 157 |
+
storeName = "WarungPOS SaaS"
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
message := fmt.Sprintf("*%s*\n\nKode OTP Reset Password Anda adalah:\n*%s*\n\nKode ini berlaku selama 10 menit. Jangan berikan kode ini kepada siapa pun.", storeName, otpCode)
|
| 161 |
+
|
| 162 |
+
return postFonnte(formattedPhone, message)
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
func SendApprovalWa(phone string, storeName string, email string) bool {
|
| 166 |
if config.GlobalConfig.FonnteToken == "" || phone == "" {
|
| 167 |
return false
|