fixed #165 Password generator is reseted if opened as single window not via generate button on entry

This commit is contained in:
michael starke
2014-03-23 21:50:33 +01:00
parent 273b77572b
commit fb0007d1c0
3 changed files with 15 additions and 3 deletions

View File

@@ -192,7 +192,7 @@ NSString *const MPDidChangeStoredKeyFilesSettings = @"com.hicknhack.macpass.MPDi
NSView *creatorView = [_passwordCreatorController view]; NSView *creatorView = [_passwordCreatorController view];
[self.passwordCreatorWindow setContentView:creatorView]; [self.passwordCreatorWindow setContentView:creatorView];
} }
[self.passwordCreatorController reset];
[self.passwordCreatorWindow makeKeyAndOrderFront:self.passwordCreatorWindow]; [self.passwordCreatorWindow makeKeyAndOrderFront:self.passwordCreatorWindow];
} }

View File

@@ -12,4 +12,11 @@
@property (copy, readonly) NSString *generatedPassword; @property (copy, readonly) NSString *generatedPassword;
/**
* Should be called to reset the generator
*
* @param sender sender of the action
*/
- (void)reset;
@end @end

View File

@@ -108,13 +108,18 @@ typedef NS_ENUM(NSUInteger, MPPasswordRating) {
[self.symbolsButton setTag:MPPasswordCharactersSymbols]; [self.symbolsButton setTag:MPPasswordCharactersSymbols];
[self _resetCharacters]; [self _resetCharacters];
[self _generatePassword:nil]; [self _generatePassword:self];
}
- (void)reset {
[self _resetCharacters];
[self _generatePassword:self];
} }
#pragma mark - #pragma mark -
#pragma mark Actions #pragma mark Actions
- (IBAction)_generatePassword:(id)sender { - (IBAction)_generatePassword:(id)sender {
if(_useCustomString) { if(_useCustomString) {
if([[_customCharactersTextField stringValue] length] > 0) { if([[_customCharactersTextField stringValue] length] > 0) {
self.password = [[_customCharactersTextField stringValue] passwordWithLength:_passwordLength]; self.password = [[_customCharactersTextField stringValue] passwordWithLength:_passwordLength];