2
0

Security answer generation for question keywords.

This commit is contained in:
Maarten Billemont 2016-04-23 23:56:16 -04:00
parent 1918c30bed
commit 3b74543c51
5 changed files with 46 additions and 24 deletions

View File

@ -49,6 +49,7 @@
- (void)resolveLoginUsingKey:(MPKey *)key result:(void ( ^ )(NSString *))result;
- (void)resolvePasswordUsingKey:(MPKey *)key result:(void ( ^ )(NSString *))result;
- (void)resolveSiteAnswerUsingKey:(MPKey *)key result:(void ( ^ )(NSString *))result;
- (void)resolveAnswerUsingKey:(MPKey *)key forQuestion:(NSString *)question result:(void ( ^ )(NSString *))result;
@end

View File

@ -209,6 +209,14 @@
[self.algorithm resolveAnswerForSite:self usingKey:key result:result];
}
- (void)resolveAnswerUsingKey:(MPKey *)key forQuestion:(NSString *)question result:(void ( ^ )(NSString *))result {
MPSiteQuestionEntity *questionEntity = [MPSiteQuestionEntity new];
questionEntity.site = self;
questionEntity.keyword = question;
[questionEntity resolveQuestionAnswerUsingKey:key result:result];
}
@end
@implementation MPGeneratedSiteEntity(MP)

View File

@ -433,6 +433,9 @@
break;
}
}];
PearlMainQueueAfter(2, ^{
[[[alert buttons] firstObject] becomeFirstResponder];
});
}
#pragma mark - Private

View File

@ -16,7 +16,6 @@
<outlet property="revealPasswordField" destination="v80-wd-hUR" id="N1U-6B-r1R"/>
<outlet property="securePasswordField" destination="iGR-wo-ual" id="DGh-5i-3u4"/>
<outlet property="securityAnswerField" destination="cp4-2G-8aG" id="9S5-Xe-njA"/>
<outlet property="securityQuestionField" destination="5pN-pY-U6l" id="Erz-GM-FVz"/>
<outlet property="securityQuestionsBox" destination="hi3-SX-Td3" id="52T-99-Qhf"/>
<outlet property="siteField" destination="CnS-iI-dhr" id="Ogo-lS-dcT"/>
<outlet property="sitePasswordTipField" destination="Ond-dT-x5d" id="jNr-gD-aJo"/>
@ -625,7 +624,7 @@ Use the arrows ⇅ to navigate the list or esc ⎋ to exit.</string>
</connections>
</textField>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="brI-fg-Kav">
<rect key="frame" x="40.5" y="111" width="96" height="19"/>
<rect key="frame" x="40" y="111" width="96" height="19"/>
<shadow key="shadow">
<color key="color" name="controlLightHighlightColor" catalog="System" colorSpace="catalog"/>
</shadow>
@ -680,7 +679,7 @@ Use the arrows ⇅ to navigate the list or esc ⎋ to exit.</string>
</connections>
</button>
<stackView distribution="fill" orientation="horizontal" alignment="top" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Bgn-Ne-fQ7" userLabel="Version Container">
<rect key="frame" x="70.5" y="56" width="36" height="22"/>
<rect key="frame" x="70" y="56" width="36" height="22"/>
<subviews>
<stepper horizontalHuggingPriority="750" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="mcq-qD-yte">
<rect key="frame" x="-3" y="-3" width="19" height="27"/>
@ -734,7 +733,7 @@ Use the arrows ⇅ to navigate the list or esc ⎋ to exit.</string>
</connections>
</stackView>
<stackView distribution="fill" orientation="horizontal" alignment="centerY" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="6II-KA-cNi" userLabel="Counter Container">
<rect key="frame" x="74.5" y="26" width="28" height="22"/>
<rect key="frame" x="74" y="26" width="28" height="22"/>
<subviews>
<stepper horizontalHuggingPriority="750" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="XgA-Vl-CKh" userLabel="Counter Stepper">
<rect key="frame" x="-3" y="-3" width="19" height="27"/>
@ -747,7 +746,7 @@ Use the arrows ⇅ to navigate the list or esc ⎋ to exit.</string>
</connections>
</stepper>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="NvO-kt-eZ2" userLabel="Counter Field">
<rect key="frame" x="19" y="1.5" width="11" height="19"/>
<rect key="frame" x="19" y="1" width="11" height="19"/>
<shadow key="shadow" blurRadius="0.5">
<size key="offset" width="0.0" height="1"/>
<color key="color" name="controlLightHighlightColor" catalog="System" colorSpace="catalog"/>
@ -880,7 +879,7 @@ Use the arrows ⇅ to navigate the list or esc ⎋ to exit.</string>
</customSpacing>
</stackView>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="luC-0j-BeV">
<rect key="frame" x="147.5" y="50" width="103" height="14"/>
<rect key="frame" x="147" y="50" width="103" height="14"/>
<shadow key="shadow" blurRadius="0.5">
<size key="offset" width="0.0" height="1"/>
<color key="color" name="controlLightHighlightColor" catalog="System" colorSpace="catalog"/>
@ -917,7 +916,7 @@ Use the arrows ⇅ to navigate the list or esc ⎋ to exit.</string>
</connections>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="gjx-bt-fKM">
<rect key="frame" x="146.5" y="80" width="100" height="14"/>
<rect key="frame" x="146" y="80" width="100" height="14"/>
<shadow key="shadow" blurRadius="0.5">
<size key="offset" width="0.0" height="1"/>
<color key="color" name="controlLightHighlightColor" catalog="System" colorSpace="catalog"/>
@ -954,7 +953,7 @@ Use the arrows ⇅ to navigate the list or esc ⎋ to exit.</string>
</connections>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="dbM-ja-dKO" userLabel="Version Tip">
<rect key="frame" x="100.5" y="106" width="332" height="14"/>
<rect key="frame" x="100" y="106" width="332" height="14"/>
<shadow key="shadow" blurRadius="0.5">
<size key="offset" width="0.0" height="1"/>
<color key="color" name="controlLightHighlightColor" catalog="System" colorSpace="catalog"/>
@ -1233,6 +1232,7 @@ Use the arrows ⇅ to navigate the list or esc ⎋ to exit.</string>
</view>
<color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/>
<color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<font key="titleFont" metaFont="message" size="11"/>
<point key="canvasLocation" x="333" y="125"/>
</box>
<box autoresizesSubviews="NO" title="Answer to security questions for apple.com:" borderType="line" id="hi3-SX-Td3">
@ -1242,19 +1242,29 @@ Use the arrows ⇅ to navigate the list or esc ⎋ to exit.</string>
<rect key="frame" x="1" y="1" width="414" height="164"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<searchField focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="5pN-pY-U6l" userLabel="Site Question">
<textField focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Yo4-M5-wL4" userLabel="Site Question">
<rect key="frame" x="10" y="140" width="394" height="16"/>
<searchFieldCell key="cell" selectable="YES" editable="YES" focusRingType="none" alignment="center" placeholderString="All Questions (click to enter a question keyword):" sendsSearchStringImmediately="YES" id="WGN-h5-Lf0">
<font key="font" metaFont="cellTitle"/>
<shadow key="shadow" blurRadius="0.5">
<size key="offset" width="0.0" height="1"/>
<color key="color" name="controlLightHighlightColor" catalog="System" colorSpace="catalog"/>
</shadow>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" state="on" focusRingType="none" alignment="center" placeholderString="All Questions (click to enter a question keyword):" usesSingleLineMode="YES" id="TUZ-X4-61A">
<font key="font" metaFont="controlContent"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</searchFieldCell>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<allowedInputSourceLocales>
<string>NSAllRomanInputSourcesLocaleIdentifier</string>
</allowedInputSourceLocales>
</textFieldCell>
<connections>
<action selector="doSearchSites:" target="-2" id="5fs-OO-jdW"/>
<binding destination="-2" name="hidden" keyPath="locked" id="hBs-gf-T7K"/>
<outlet property="delegate" destination="-2" id="l5W-a4-HVp"/>
<binding destination="mcS-ik-b0n" name="value" keyPath="selection.question" id="hAN-q1-w37">
<dictionary key="options">
<bool key="NSContinuouslyUpdatesValue" value="YES"/>
</dictionary>
</binding>
<outlet property="delegate" destination="-2" id="iaJ-UQ-AQh"/>
</connections>
</searchField>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="cp4-2G-8aG" userLabel="Site Answer">
<rect key="frame" x="10" y="103" width="394" height="29"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="fewc fom pugsuhe xav" placeholderString="" id="oYj-IR-xmw">
@ -1282,13 +1292,13 @@ Use the arrows ⇅ to navigate the list or esc ⎋ to exit.</string>
</textField>
</subviews>
<constraints>
<constraint firstItem="5pN-pY-U6l" firstAttribute="top" secondItem="8Ep-zH-Nzv" secondAttribute="top" constant="8" id="8hz-kA-7hC"/>
<constraint firstItem="12d-V9-LDB" firstAttribute="top" secondItem="cp4-2G-8aG" secondAttribute="bottom" constant="8" symbolic="YES" id="KBI-1d-ArD"/>
<constraint firstAttribute="trailing" secondItem="cp4-2G-8aG" secondAttribute="trailing" constant="12" id="M6h-YI-ZFp"/>
<constraint firstItem="cp4-2G-8aG" firstAttribute="leading" secondItem="8Ep-zH-Nzv" secondAttribute="leading" constant="12" id="MbE-fa-yjw"/>
<constraint firstItem="cp4-2G-8aG" firstAttribute="top" secondItem="5pN-pY-U6l" secondAttribute="bottom" constant="8" symbolic="YES" id="OlG-5f-1wE"/>
<constraint firstAttribute="trailing" secondItem="5pN-pY-U6l" secondAttribute="trailing" constant="12" id="dja-Ll-AdT"/>
<constraint firstItem="5pN-pY-U6l" firstAttribute="leading" secondItem="8Ep-zH-Nzv" secondAttribute="leading" constant="12" id="tPO-Bt-B8h"/>
<constraint firstItem="Yo4-M5-wL4" firstAttribute="leading" secondItem="8Ep-zH-Nzv" secondAttribute="leading" constant="12" id="Reh-0N-l24"/>
<constraint firstItem="Yo4-M5-wL4" firstAttribute="top" secondItem="8Ep-zH-Nzv" secondAttribute="top" constant="8" id="X21-9L-8bM"/>
<constraint firstItem="cp4-2G-8aG" firstAttribute="top" secondItem="Yo4-M5-wL4" secondAttribute="bottom" constant="8" symbolic="YES" id="jVu-Mh-Y2Q"/>
<constraint firstAttribute="trailing" secondItem="Yo4-M5-wL4" secondAttribute="trailing" constant="12" id="jWU-32-fd8"/>
</constraints>
</view>
<constraints>
@ -1298,6 +1308,7 @@ Use the arrows ⇅ to navigate the list or esc ⎋ to exit.</string>
</constraints>
<color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/>
<color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<font key="titleFont" metaFont="message" size="11"/>
<point key="canvasLocation" x="333" y="491"/>
</box>
</objects>

View File

@ -226,9 +226,8 @@
[entity resolveLoginUsingKey:[MPAppDelegate_Shared get].key result:^(NSString *result) {
[self updateLoginNameWithResult:result];
}];
[entity resolveSiteAnswerUsingKey:[MPAppDelegate_Shared get].key result:^(NSString *result) {
[self updateAnswerWithResult:result];
}];
[self updateAnswerWithResult:[self.algorithm generateAnswerForSiteNamed:self.name onQuestion:self.question
usingKey:[MPAppDelegate_Shared get].key]];
}
- (void)updatePasswordWithResult:(NSString *)result {