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 {
@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 QString accountToMigrate;
......
......@@ -27,12 +27,12 @@
@interface MigrateRingAccountsWC() <NSTextFieldDelegate>{
__unsafe_unretained IBOutlet NSSecureTextField* passwordField;
__unsafe_unretained IBOutlet NSSecureTextField* passwordConfirmField;
__unsafe_unretained IBOutlet NSTextField* infoField;
__unsafe_unretained IBOutlet NSTextField* errorField;
__unsafe_unretained IBOutlet ITProgressIndicator* progressIndicator;
__unsafe_unretained IBOutlet NSImageView* profileImage;
__unsafe_unretained IBOutlet NSTextField* alias;
__strong IBOutlet NSLayoutConstraint *infoTopConstraints;
}
- (IBAction)onClickComplete:(id)sender;
......@@ -83,9 +83,12 @@ QMetaObject::Connection stateChanged;
profileImage.image = image;
} else {
profileImage.image = [NSImage imageNamed:@"default_avatar_overlay.png"];
profileImage.wantsLayer = YES;
profileImage.layer.backgroundColor = [[NSColor grayColor] CGColor];
}
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")];
[infoMessage appendAttributedString:[[NSAttributedString alloc] initWithString:@"\n"]];
......@@ -135,9 +138,6 @@ QMetaObject::Connection stateChanged;
- (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];
errorTimer = [NSTimer scheduledTimerWithTimeInterval:30
target:self
......@@ -156,22 +156,9 @@ QMetaObject::Connection stateChanged;
}
});
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);
}
}
- (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
- (void)didComplete
......
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="15705" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="15705"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
......@@ -12,8 +12,8 @@
<outlet property="errorField" destination="G1N-th-ZtP" id="OZ1-F7-jN7"/>
<outlet property="finalContainer" destination="D9c-cc-43F" id="MqY-nC-dhp"/>
<outlet property="infoField" destination="Qx0-KE-jEl" id="ACx-L8-XrX"/>
<outlet property="infoTopConstraints" destination="L6r-HW-Gdc" id="6hN-26-D2b"/>
<outlet property="initialContainer" destination="xUT-yB-g8Q" id="RY9-PG-fGI"/>
<outlet property="passwordConfirmField" destination="fb6-6f-oqD" id="zo7-JA-tSY"/>
<outlet property="passwordField" destination="vej-Z8-dOm" id="2t8-o5-iHa"/>
<outlet property="profileImage" destination="Rd7-Mr-0Ba" id="i13-IJ-6aA"/>
<outlet property="progressContainer" destination="IbM-NP-t4j" id="1tS-X7-u5j"/>
......@@ -27,24 +27,24 @@
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="508" height="408"/>
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
<view key="contentView" id="EiT-Mj-1SZ">
<rect key="frame" x="0.0" y="0.0" width="508" height="365"/>
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="877"/>
<view key="contentView" misplaced="YES" id="EiT-Mj-1SZ">
<rect key="frame" x="0.0" y="0.0" width="508" height="319"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="xUT-yB-g8Q" userLabel="Migration Container">
<rect key="frame" x="20" y="20" width="468" height="335"/>
<rect key="frame" x="20" y="20" width="468" height="311"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="YR8-e7-f8B">
<rect key="frame" x="-2" y="318" width="472" height="17"/>
<rect key="frame" x="-2" y="276" width="472" height="35"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="Account migration required" id="wmv-sA-Mlh">
<font key="font" metaFont="systemBold"/>
<font key="font" metaFont="system" size="30"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Rd7-Mr-0Ba">
<rect key="frame" x="194" y="218" width="80" height="80"/>
<rect key="frame" x="194" y="176" width="80" height="80"/>
<constraints>
<constraint firstAttribute="width" constant="80" id="TsS-Ox-Cp7"/>
<constraint firstAttribute="height" constant="80" id="aHe-uA-JfI"/>
......@@ -52,15 +52,15 @@
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="z7T-Po-6wb"/>
</imageView>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="q5O-af-3lp">
<rect key="frame" x="230" y="179" width="8" height="19"/>
<rect key="frame" x="230" y="133" width="8" height="23"/>
<textFieldCell key="cell" lineBreakMode="clipping" alignment="center" id="tEj-uA-vQ3">
<font key="font" metaFont="system" size="15"/>
<font key="font" metaFont="systemLight" size="20"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="Qx0-KE-jEl">
<rect key="frame" x="-2" y="125" width="472" height="34"/>
<rect key="frame" x="-2" y="81" width="472" height="32"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="justified" title="To proceed with the migration, you need to enter a password that was used for this account." placeholderString="RingID" id="859-10-HEb">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
......@@ -68,7 +68,7 @@
</textFieldCell>
</textField>
<secureTextField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="vej-Z8-dOm">
<rect key="frame" x="105" y="86" width="307" height="22"/>
<rect key="frame" x="105" y="43" width="285" height="21"/>
<secureTextFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" borderStyle="bezel" placeholderString="Password..." drawsBackground="YES" usesSingleLineMode="YES" id="xqz-Uz-hqU">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
......@@ -78,23 +78,9 @@
</allowedInputSourceLocales>
</secureTextFieldCell>
<connections>
<binding destination="-2" name="value" keyPath="self.password" id="WWB-sb-wyk">
<dictionary key="options">
<bool key="NSConditionallySetsEditable" value="NO"/>
<bool key="NSContinuouslyUpdatesValue" value="YES"/>
</dictionary>
</binding>
<outlet property="delegate" destination="-2" id="UEj-AI-SPU"/>
</connections>
</secureTextField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="bZ5-at-jng">
<rect key="frame" x="-2" y="46" width="83" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Confirmation" id="aOa-1q-AZe">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="oXB-Be-LaB">
<rect key="frame" x="387" y="-7" width="87" height="32"/>
<buttonCell key="cell" type="push" title="Migrate" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="rW5-Il-5YD">
......@@ -106,11 +92,10 @@ DQ
</buttonCell>
<connections>
<action selector="startMigration:" target="-2" id="MW5-vm-X5X"/>
<binding destination="-2" name="enabled" keyPath="self.validatePasswords" id="vyp-i8-Drw"/>
</connections>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Bcr-Pl-Fz9">
<rect key="frame" x="-2" y="89" width="63" height="17"/>
<rect key="frame" x="-2" y="46" width="63" height="16"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Password" id="vwh-K9-3O9">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
......@@ -128,39 +113,16 @@ DQ
</buttonCell>
<connections>
<action selector="removeAccount:" target="-2" id="6x2-Kw-3cs"/>
<binding destination="-2" name="enabled" keyPath="self.validatePasswords" id="5Yl-nN-WRo"/>
</connections>
</button>
<secureTextField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="fb6-6f-oqD" userLabel="Password confirmation">
<rect key="frame" x="105" y="43" width="307" height="22"/>
<secureTextFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" borderStyle="bezel" placeholderString="Confirm your new password..." drawsBackground="YES" usesSingleLineMode="YES" id="KuO-oT-zhY">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
<allowedInputSourceLocales>
<string>NSAllRomanInputSourcesLocaleIdentifier</string>
</allowedInputSourceLocales>
</secureTextFieldCell>
<connections>
<binding destination="-2" name="value" keyPath="self.passwordConfirmation" id="mVZ-rM-3Px">
<dictionary key="options">
<bool key="NSContinuouslyUpdatesValue" value="YES"/>
</dictionary>
</binding>
<outlet property="delegate" destination="-2" id="4W6-t5-1uA"/>
</connections>
</secureTextField>
</subviews>
<constraints>
<constraint firstItem="oXB-Be-LaB" firstAttribute="leading" secondItem="uJp-Ce-Wi4" secondAttribute="trailing" constant="20" id="1nX-wV-dun"/>
<constraint firstItem="oXB-Be-LaB" firstAttribute="top" secondItem="bZ5-at-jng" secondAttribute="bottom" constant="25" id="3B0-lL-kAc"/>
<constraint firstAttribute="trailing" secondItem="Qx0-KE-jEl" secondAttribute="trailing" id="6At-Ny-s4i"/>
<constraint firstItem="fb6-6f-oqD" firstAttribute="width" secondItem="vej-Z8-dOm" secondAttribute="width" id="6T4-XK-uNu"/>
<constraint firstItem="YR8-e7-f8B" firstAttribute="top" secondItem="xUT-yB-g8Q" secondAttribute="top" id="75b-jc-goZ"/>
<constraint firstAttribute="bottom" secondItem="oXB-Be-LaB" secondAttribute="bottom" id="78c-rz-zWu"/>
<constraint firstItem="Qx0-KE-jEl" firstAttribute="leading" secondItem="xUT-yB-g8Q" secondAttribute="leading" id="96K-5h-fNe"/>
<constraint firstItem="Rd7-Mr-0Ba" firstAttribute="top" secondItem="YR8-e7-f8B" secondAttribute="bottom" constant="20" id="EQb-rk-d8z"/>
<constraint firstItem="fb6-6f-oqD" firstAttribute="baseline" secondItem="bZ5-at-jng" secondAttribute="baseline" id="FcI-8l-Et0"/>
<constraint firstItem="vej-Z8-dOm" firstAttribute="leading" secondItem="Bcr-Pl-Fz9" secondAttribute="trailing" constant="46" id="H6a-lV-9HO"/>
<constraint firstItem="Bcr-Pl-Fz9" firstAttribute="baseline" secondItem="vej-Z8-dOm" secondAttribute="baseline" id="HWL-uz-9td"/>
<constraint firstItem="vej-Z8-dOm" firstAttribute="top" secondItem="Qx0-KE-jEl" secondAttribute="bottom" constant="17" id="JRl-83-1RI"/>
......@@ -170,22 +132,20 @@ DQ
<constraint firstItem="oXB-Be-LaB" firstAttribute="centerY" secondItem="uJp-Ce-Wi4" secondAttribute="centerY" id="Osz-oy-Cq6"/>
<constraint firstItem="q5O-af-3lp" firstAttribute="top" secondItem="Rd7-Mr-0Ba" secondAttribute="bottom" constant="20" id="RmP-gN-GXn"/>
<constraint firstItem="Rd7-Mr-0Ba" firstAttribute="centerX" secondItem="xUT-yB-g8Q" secondAttribute="centerX" id="Zar-t5-7oB"/>
<constraint firstItem="bZ5-at-jng" firstAttribute="leading" secondItem="xUT-yB-g8Q" secondAttribute="leading" id="a8B-2s-qAO"/>
<constraint firstItem="bZ5-at-jng" firstAttribute="top" secondItem="Bcr-Pl-Fz9" secondAttribute="bottom" constant="26" id="hH4-Ug-Jki"/>
<constraint firstItem="uJp-Ce-Wi4" firstAttribute="top" secondItem="Bcr-Pl-Fz9" secondAttribute="bottom" constant="25" id="fcP-Be-dVr"/>
<constraint firstItem="q5O-af-3lp" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="xUT-yB-g8Q" secondAttribute="leading" constant="20" id="iIg-oc-Dah"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="q5O-af-3lp" secondAttribute="trailing" constant="20" id="jm8-Gq-IM4"/>
<constraint firstAttribute="trailing" secondItem="YR8-e7-f8B" secondAttribute="trailing" id="kQs-lk-qMI"/>
<constraint firstItem="vej-Z8-dOm" firstAttribute="leading" secondItem="xUT-yB-g8Q" secondAttribute="leading" constant="105" id="q8m-JB-plh"/>
<constraint firstItem="vej-Z8-dOm" firstAttribute="leading" secondItem="fb6-6f-oqD" secondAttribute="leading" id="vN2-rY-7tJ"/>
<constraint firstItem="YR8-e7-f8B" firstAttribute="leading" secondItem="xUT-yB-g8Q" secondAttribute="leading" id="xjG-Vn-8Kc"/>
<constraint firstAttribute="trailing" secondItem="oXB-Be-LaB" secondAttribute="trailing" id="zBf-Ov-zq7"/>
</constraints>
</customView>
<customView hidden="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ty1-sj-tT6">
<rect key="frame" x="20" y="20" width="468" height="335"/>
<rect key="frame" x="20" y="20" width="468" height="311"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="RfX-YR-bbB">
<rect key="frame" x="-2" y="318" width="472" height="17"/>
<rect key="frame" x="-2" y="295" width="472" height="16"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="Account migration error" id="8K3-9Z-MKH">
<font key="font" metaFont="systemBold"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
......@@ -193,7 +153,7 @@ DQ
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="G1N-th-ZtP">
<rect key="frame" x="-2" y="282" width="472" height="17"/>
<rect key="frame" x="-2" y="260" width="472" height="16"/>
<textFieldCell key="cell" controlSize="mini" sendsActionOnEndEditing="YES" alignment="left" placeholderString="error label" id="e7n-Ev-bK7">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
......@@ -201,7 +161,7 @@ DQ
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="cxh-K7-1eh">
<rect key="frame" x="403" y="-7" width="71" height="32"/>
<rect key="frame" x="407" y="-7" width="67" height="32"/>
<buttonCell key="cell" type="push" title="OK" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="VN1-A3-RIh">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
......@@ -239,10 +199,10 @@ DQ
</constraints>
</customView>
<customView hidden="YES" translatesAutoresizingMaskIntoConstraints="NO" id="D9c-cc-43F">
<rect key="frame" x="20" y="20" width="468" height="335"/>
<rect key="frame" x="20" y="20" width="468" height="311"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="suF-b1-Duk">
<rect key="frame" x="-2" y="318" width="472" height="17"/>
<rect key="frame" x="-2" y="295" width="472" height="16"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="Account migration completed" id="1ob-x1-u74">
<font key="font" metaFont="systemBold"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
......@@ -263,7 +223,7 @@ DQ
</connections>
</button>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="wRp-RS-wdh">
<rect key="frame" x="-2" y="281" width="472" height="17"/>
<rect key="frame" x="-2" y="259" width="472" height="16"/>
<textFieldCell key="cell" controlSize="mini" sendsActionOnEndEditing="YES" alignment="left" title="Congratulations, your account has been migrated with Success." placeholderString="" id="C2l-rz-Gqt">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
......@@ -283,7 +243,7 @@ DQ
</constraints>
</customView>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="IbM-NP-t4j">
<rect key="frame" x="64" y="99" width="380" height="167"/>
<rect key="frame" x="64" y="87" width="380" height="167"/>
<subviews>
<customView hidden="YES" translatesAutoresizingMaskIntoConstraints="NO" id="LsP-hk-8Om" customClass="ITProgressIndicator">
<rect key="frame" x="155" y="49" width="70" height="70"/>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment