Skip to content
Snippets Groups Projects
Commit 3a2dc0ce authored by Kateryna Kostiuk's avatar Kateryna Kostiuk
Browse files

account migration: remove password confirmation field

Change-Id: I03148a51b583426df21436bb78e31ab7783193ec
parent aae92d8a
No related branches found
No related tags found
No related merge requests found
...@@ -41,27 +41,6 @@ namespace lrc { ...@@ -41,27 +41,6 @@ namespace lrc {
@interface MigrateRingAccountsWC : AbstractLoadingWC <LoadingWCProtocol> @interface MigrateRingAccountsWC : AbstractLoadingWC <LoadingWCProtocol>
/**
* password string contained in passwordField.
*/
@property (retain) NSString* password;
/**
* passwordConfirmation string contained in passwordConfirmationField.
*/
@property (retain) NSString* passwordConfirmation;
/**
* computed properties calculated by password string contained in
* passwordField and passwordCOnfirmation string contained
* inpasswordConfirmationField
* This is a KVO method to bind the text with the OK Button
* if password.length is > 0 AND passwordConfirmation.length > 0
* AND password isEqualsToString passwordCOnfirmationbutton is enabled,
* otherwise disabled
*/
@property (readonly) BOOL validatePasswords;
@property lrc::api::NewAccountModel* accountModel; @property lrc::api::NewAccountModel* accountModel;
@property QString accountToMigrate; @property QString accountToMigrate;
......
...@@ -27,12 +27,12 @@ ...@@ -27,12 +27,12 @@
@interface MigrateRingAccountsWC() <NSTextFieldDelegate>{ @interface MigrateRingAccountsWC() <NSTextFieldDelegate>{
__unsafe_unretained IBOutlet NSSecureTextField* passwordField; __unsafe_unretained IBOutlet NSSecureTextField* passwordField;
__unsafe_unretained IBOutlet NSSecureTextField* passwordConfirmField;
__unsafe_unretained IBOutlet NSTextField* infoField; __unsafe_unretained IBOutlet NSTextField* infoField;
__unsafe_unretained IBOutlet NSTextField* errorField; __unsafe_unretained IBOutlet NSTextField* errorField;
__unsafe_unretained IBOutlet ITProgressIndicator* progressIndicator; __unsafe_unretained IBOutlet ITProgressIndicator* progressIndicator;
__unsafe_unretained IBOutlet NSImageView* profileImage; __unsafe_unretained IBOutlet NSImageView* profileImage;
__unsafe_unretained IBOutlet NSTextField* alias; __unsafe_unretained IBOutlet NSTextField* alias;
__strong IBOutlet NSLayoutConstraint *infoTopConstraints;
} }
- (IBAction)onClickComplete:(id)sender; - (IBAction)onClickComplete:(id)sender;
...@@ -83,9 +83,12 @@ QMetaObject::Connection stateChanged; ...@@ -83,9 +83,12 @@ QMetaObject::Connection stateChanged;
profileImage.image = image; profileImage.image = image;
} else { } else {
profileImage.image = [NSImage imageNamed:@"default_avatar_overlay.png"]; profileImage.image = [NSImage imageNamed:@"default_avatar_overlay.png"];
profileImage.wantsLayer = YES;
profileImage.layer.backgroundColor = [[NSColor grayColor] CGColor]; profileImage.layer.backgroundColor = [[NSColor grayColor] CGColor];
} }
alias.stringValue = accountInfo.profileInfo.alias.toNSString(); alias.stringValue = accountInfo.profileInfo.alias.toNSString();
infoTopConstraints.constant = accountInfo.profileInfo.alias.isEmpty() ? -20 : 20;
NSMutableAttributedString* infoMessage = [[NSMutableAttributedString alloc] initWithString:NSLocalizedString(@"This account needs to be migrated",@"Text shown to the user")]; NSMutableAttributedString* infoMessage = [[NSMutableAttributedString alloc] initWithString:NSLocalizedString(@"This account needs to be migrated",@"Text shown to the user")];
[infoMessage appendAttributedString:[[NSAttributedString alloc] initWithString:@"\n"]]; [infoMessage appendAttributedString:[[NSAttributedString alloc] initWithString:@"\n"]];
...@@ -135,9 +138,6 @@ QMetaObject::Connection stateChanged; ...@@ -135,9 +138,6 @@ QMetaObject::Connection stateChanged;
- (IBAction)startMigration:(NSButton *)sender - (IBAction)startMigration:(NSButton *)sender
{ {
if (![self validatePasswords]) {
[self showError:NSLocalizedString(@"Password and confirmation mismatch.",@"Text show to the user when password didn't match")];
} else {
[self showLoading]; [self showLoading];
errorTimer = [NSTimer scheduledTimerWithTimeInterval:30 errorTimer = [NSTimer scheduledTimerWithTimeInterval:30
target:self target:self
...@@ -156,22 +156,9 @@ QMetaObject::Connection stateChanged; ...@@ -156,22 +156,9 @@ QMetaObject::Connection stateChanged;
} }
}); });
lrc::api::account::ConfProperties_t accountProperties = self.accountModel->getAccountConfig(accountToMigrate); lrc::api::account::ConfProperties_t accountProperties = self.accountModel->getAccountConfig(accountToMigrate);
accountProperties.archivePassword = QString::fromNSString(self.password); accountProperties.archivePassword = QString::fromNSString(passwordField.stringValue);
self.accountModel->setAccountConfig(accountToMigrate, accountProperties); self.accountModel->setAccountConfig(accountToMigrate, accountProperties);
} }
}
- (BOOL)validatePasswords
{
BOOL result = (self.password.length != 0 && [self.password isEqualToString:self.passwordConfirmation]);
NSLog(@"ValidatesPasswords : %s", result ? "true" : "false");
return result;
}
+ (NSSet *)keyPathsForValuesAffectingValidatePasswords
{
return [NSSet setWithObjects:@"password", @"passwordConfirmation", nil];
}
#pragma mark - Delegates #pragma mark - Delegates
- (void)didComplete - (void)didComplete
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment