mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 07:02:39 +00:00
Added placeholder strings and updates to correspond to enable/disable of password in unlock and change password window
This commit is contained in:
@@ -78,7 +78,7 @@ DQ
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="191" id="389"/>
|
||||
</constraints>
|
||||
<secureTextFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" usesSingleLineMode="YES" id="339">
|
||||
<secureTextFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" placeholderString="Enter Password" drawsBackground="YES" usesSingleLineMode="YES" id="339">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
@property (nonatomic, weak) MPDocument *currentDocument;
|
||||
@property (nonatomic, assign) BOOL showPassword;
|
||||
@property (nonatomic, assign) BOOL enablePassword;
|
||||
@property (nonatomic, assign) BOOL hasValidPasswordOrKey;
|
||||
@property (nonatomic, weak) NSURL *keyURL;
|
||||
|
||||
@@ -42,6 +43,7 @@
|
||||
[super windowDidLoad];
|
||||
[self.togglePasswordButton bind:NSValueBinding toObject:self withKeyPath:@"showPassword" options:nil];
|
||||
[[self window] setDefaultButtonCell:[self.changePasswordButton cell]];
|
||||
self.enablePassword = _currentDocument.compositeKey.hasPassword;
|
||||
}
|
||||
|
||||
- (void)updateView {
|
||||
@@ -55,11 +57,13 @@
|
||||
//self.keyURL = _currentDocument.key;
|
||||
|
||||
NSDictionary *negateOption = @{ NSValueTransformerNameBindingOption : NSNegateBooleanTransformerName };
|
||||
[self.hasPasswordSwitchButton bind:NSValueBinding toObject:self withKeyPath:@"enablePassword" options:nil];
|
||||
[self.passwordTextField bind:@"showPassword" toObject:self withKeyPath:@"showPassword" options:nil];
|
||||
[self.passwordTextField bind:NSEnabledBinding toObject:self.hasPasswordSwitchButton withKeyPath:@"cell.state" options:nil];
|
||||
[self.passwordTextField bind:NSEnabledBinding toObject:self withKeyPath:@"enablePassword" options:nil];
|
||||
[self.togglePasswordButton bind:NSValueBinding toObject:self withKeyPath:@"showPassword" options:nil];
|
||||
[self.togglePasswordButton bind:NSEnabledBinding toObject:self withKeyPath:@"enablePassword" options:nil];
|
||||
[self.passwordRepeatTextField bind:NSEnabledBinding toObject:self withKeyPath:@"showPassword" options:negateOption];
|
||||
[self.passwordRepeatTextField bind:NSEnabledBinding toObject:self.hasPasswordSwitchButton withKeyPath:@"cell.state" options:nil];
|
||||
[self.passwordRepeatTextField bind:NSEnabledBinding toObject:self withKeyPath:@"enablePassword" options:nil];
|
||||
[self.errorTextField bind:NSHiddenBinding toObject:self withKeyPath:@"hasValidPasswordOrKey" options:nil];
|
||||
[self.changePasswordButton bind:NSEnabledBinding toObject:self withKeyPath:@"hasValidPasswordOrKey" options:nil];
|
||||
[self.keyfilePathControl bind:NSValueBinding toObject:self withKeyPath:@"keyURL" options:nil];
|
||||
@@ -72,6 +76,7 @@
|
||||
self.isDirty = NO;
|
||||
}
|
||||
|
||||
#pragma mark Properties
|
||||
- (void)setShowPassword:(BOOL)showPassword {
|
||||
if(_showPassword != showPassword) {
|
||||
_showPassword = showPassword;
|
||||
@@ -84,6 +89,15 @@
|
||||
_keyURL = keyURL;
|
||||
[self _verifyPasswordAndKey];
|
||||
}
|
||||
- (void)setEnablePassword:(BOOL)enablePassword {
|
||||
if(_enablePassword != enablePassword) {
|
||||
_enablePassword = enablePassword;
|
||||
}
|
||||
NSString *passwordPlaceHolder = _enablePassword ? NSLocalizedString(@"PASSWORD_INPUT_ENTER_PASSWORD", "") : NSLocalizedString(@"PASSWORD_INPUT_NO_PASSWORD", "");
|
||||
NSString *repeatPlaceHolder = _enablePassword ? NSLocalizedString(@"PASSWORD_INPUT_REPEAT_PASSWORD", "") : NSLocalizedString(@"PASSWORD_INPUT_NO_PASSWORD", "");
|
||||
[[self.passwordTextField cell] setPlaceholderString:passwordPlaceHolder];
|
||||
[[self.passwordRepeatTextField cell] setPlaceholderString:repeatPlaceHolder];
|
||||
}
|
||||
|
||||
#pragma mark Actions
|
||||
- (IBAction)save:(id)sender {
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
@property (weak) IBOutlet NSButton *enablePasswordCheckBox;
|
||||
|
||||
@property (assign) BOOL showPassword;
|
||||
@property (assign) BOOL enablePassword;
|
||||
@property (nonatomic, assign) BOOL enablePassword;
|
||||
|
||||
@end
|
||||
|
||||
@@ -70,6 +70,19 @@
|
||||
[self _reset];
|
||||
}
|
||||
|
||||
#pragma mark Properties
|
||||
- (void)setEnablePassword:(BOOL)enablePassword {
|
||||
if(_enablePassword != enablePassword) {
|
||||
_enablePassword = enablePassword;
|
||||
if(!_enablePassword) {
|
||||
[self.passwordTextField setStringValue:@""];
|
||||
}
|
||||
}
|
||||
NSString *placeHolderString = _enablePassword ? NSLocalizedString(@"PASSWORD_INPUT_ENTER_PASSWORD", "") : NSLocalizedString(@"PASSWORD_INPUT_NO_PASSWORD", "");
|
||||
[[self.passwordTextField cell] setPlaceholderString:placeHolderString];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Private
|
||||
- (IBAction)_decrypt:(id)sender {
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
<secureTextField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="9" customClass="HNHRoundedSecureTextField">
|
||||
<rect key="frame" x="108" y="145" width="168" height="22"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<secureTextFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" usesSingleLineMode="YES" id="18">
|
||||
<secureTextFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" placeholderString="Enter Password" drawsBackground="YES" usesSingleLineMode="YES" id="18">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
@@ -108,7 +108,7 @@
|
||||
<secureTextField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="11" customClass="HNHRoundedSecureTextField">
|
||||
<rect key="frame" x="108" y="115" width="168" height="22"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<secureTextFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" usesSingleLineMode="YES" id="15">
|
||||
<secureTextFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" placeholderString="Repeat Password" drawsBackground="YES" usesSingleLineMode="YES" id="15">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user