Fix the color the passwords
- in the password editing view - color of some characters
This commit is contained in:
parent
2899f05a73
commit
ca66cd8e6c
3 changed files with 9 additions and 1 deletions
|
|
@ -133,7 +133,7 @@ class Utils {
|
||||||
for (index, element) in plainPassword.unicodeScalars.enumerated() {
|
for (index, element) in plainPassword.unicodeScalars.enumerated() {
|
||||||
if NSCharacterSet.decimalDigits.contains(element) {
|
if NSCharacterSet.decimalDigits.contains(element) {
|
||||||
attributedPassword.addAttribute(NSForegroundColorAttributeName, value: Globals.red, range: NSRange(location: index, length: 1))
|
attributedPassword.addAttribute(NSForegroundColorAttributeName, value: Globals.red, range: NSRange(location: index, length: 1))
|
||||||
} else if NSCharacterSet.punctuationCharacters.contains(element) {
|
} else if !NSCharacterSet.letters.contains(element) {
|
||||||
attributedPassword.addAttribute(NSForegroundColorAttributeName, value: Globals.blue, range: NSRange(location: index, length: 1))
|
attributedPassword.addAttribute(NSForegroundColorAttributeName, value: Globals.blue, range: NSRange(location: index, length: 1))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,11 @@ class FillPasswordTableViewCell: ContentTableViewCell {
|
||||||
self.delegate?.generateAndCopyPassword()
|
self.delegate?.generateAndCopyPassword()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// re-color
|
||||||
|
@IBAction func textFieldDidChange(_ sender: UITextField) {
|
||||||
|
contentTextField.attributedText = Utils.attributedPassword(plainPassword: sender.text ?? "")
|
||||||
|
}
|
||||||
|
|
||||||
override func getContent() -> String? {
|
override func getContent() -> String? {
|
||||||
return contentTextField.attributedText?.string
|
return contentTextField.attributedText?.string
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,9 @@
|
||||||
<nil key="textColor"/>
|
<nil key="textColor"/>
|
||||||
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
||||||
<textInputTraits key="textInputTraits" autocorrectionType="no" spellCheckingType="no" keyboardType="alphabet"/>
|
<textInputTraits key="textInputTraits" autocorrectionType="no" spellCheckingType="no" keyboardType="alphabet"/>
|
||||||
|
<connections>
|
||||||
|
<action selector="textFieldDidChange:" destination="KGk-i7-Jjw" eventType="editingChanged" id="U0t-2B-JxY"/>
|
||||||
|
</connections>
|
||||||
</textField>
|
</textField>
|
||||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" reversesTitleShadowWhenHighlighted="YES" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="hTh-ek-Xam">
|
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" reversesTitleShadowWhenHighlighted="YES" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="hTh-ek-Xam">
|
||||||
<rect key="frame" x="243" y="-0.5" width="64" height="89.5"/>
|
<rect key="frame" x="243" y="-0.5" width="64" height="89.5"/>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue