Skip to content

Commit f5beaa7

Browse files
author
Ahmet Sina Ustem
committed
Password Rule fixed
1 parent 84e47a4 commit f5beaa7

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

ALFormInput/Classes/ALValidatableTextFieldType.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,17 @@ public enum ALValidatableTextFieldType: String {
3939
ExactLengthRule(length: length, message: "%ld karakter olmalıdır")
4040
}
4141

42+
private func passwordRule(_ length: Int) -> PasswordRule {
43+
PasswordRule(regex: "^(?=.*?[A-Z]).{\(length),}$",
44+
message: String(format: "En az %ld karakter olmalıdır", length))
45+
}
46+
4247
public var rules : [Rule] {
4348
switch self {
4449
case .email:
4550
return [requiredRule, emailRule]
4651
case .password:
47-
return [requiredRule, PasswordRule()]
52+
return [requiredRule, passwordRule(6)]
4853
case .name, .surname:
4954
return [requiredRule, minLengthRule(3)]
5055
case .phoneNumber:

0 commit comments

Comments
 (0)