frontend: disabled button while processing password reset
This commit is contained in:
27
go-backend/internal/validation/bankAccount_validation.go
Normal file
27
go-backend/internal/validation/bankAccount_validation.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package validation
|
||||
|
||||
import (
|
||||
"GoMembership/internal/models"
|
||||
|
||||
"github.com/go-playground/validator/v10"
|
||||
"github.com/jbub/banking/iban"
|
||||
"github.com/jbub/banking/swift"
|
||||
)
|
||||
|
||||
func validateBankAccount(sl validator.StructLevel) {
|
||||
ba := sl.Current().Interface().(models.User).BankAccount
|
||||
if !ibanValidator(ba.IBAN) {
|
||||
sl.ReportError(ba.IBAN, "IBAN", "BankAccount.IBAN", "required", "")
|
||||
}
|
||||
if ba.BIC != "" && !bicValidator(ba.BIC) {
|
||||
sl.ReportError(ba.IBAN, "IBAN", "BankAccount.IBAN", "required", "")
|
||||
}
|
||||
}
|
||||
|
||||
func ibanValidator(fieldValue string) bool {
|
||||
return iban.Validate(fieldValue) == nil
|
||||
}
|
||||
|
||||
func bicValidator(fieldValue string) bool {
|
||||
return swift.Validate(fieldValue) == nil
|
||||
}
|
||||
Reference in New Issue
Block a user