enforced password changes are only possible after unlock, not before save anymore. Support for one-time forced changes added.

This commit is contained in:
michael starke
2017-10-13 16:43:51 +02:00
parent 0712fccbb1
commit f066038476
9 changed files with 107 additions and 65 deletions

View File

@@ -1,3 +1,3 @@
github "sparkle-project/Sparkle" ~> 1.18.1 github "sparkle-project/Sparkle" ~> 1.18.1
github "mstarke/KeePassKit" "6cf17cc6f730c72b02d69ef4becdaceabbc15bd7" github "mstarke/KeePassKit" ~> 1.2
github "mstarke/HNHUi" ~> 1.1 github "mstarke/HNHUi" ~> 1.1

View File

@@ -1,3 +1,3 @@
github "mstarke/HNHUi" "1.2" github "mstarke/HNHUi" "1.2"
github "mstarke/KeePassKit" "6cf17cc6f730c72b02d69ef4becdaceabbc15bd7" github "mstarke/KeePassKit" "1.2"
github "sparkle-project/Sparkle" "1.18.1" github "sparkle-project/Sparkle" "1.18.1"

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11542" systemVersion="16B2555" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES"> <document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="13196" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies> <dependencies>
<deployment identifier="macosx"/> <deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11542"/> <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13196"/>
<capability name="box content view" minToolsVersion="7.0"/> <capability name="box content view" minToolsVersion="7.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies> </dependencies>
@@ -28,6 +28,7 @@
<outlet property="enableTrashCheckButton" destination="535" id="UNd-h9-aw3"/> <outlet property="enableTrashCheckButton" destination="535" id="UNd-h9-aw3"/>
<outlet property="enforceKeyChangeCheckButton" destination="upv-b3-vCc" id="JjM-CX-15q"/> <outlet property="enforceKeyChangeCheckButton" destination="upv-b3-vCc" id="JjM-CX-15q"/>
<outlet property="enforceKeyChangeIntervalTextField" destination="VYh-cm-fix" id="aqu-Dm-tlH"/> <outlet property="enforceKeyChangeIntervalTextField" destination="VYh-cm-fix" id="aqu-Dm-tlH"/>
<outlet property="enforceKeyChangeOnceCheckButton" destination="VMc-Qg-eCr" id="Ith-Jn-JVX"/>
<outlet property="historyMaximumItemsTextField" destination="593" id="NrX-e0-8Dw"/> <outlet property="historyMaximumItemsTextField" destination="593" id="NrX-e0-8Dw"/>
<outlet property="historyMaxiumSizeTextField" destination="1273" id="5Fo-Pp-8dY"/> <outlet property="historyMaxiumSizeTextField" destination="1273" id="5Fo-Pp-8dY"/>
<outlet property="keyDerivationPopupButton" destination="5D9-bT-JAr" id="90K-97-HQW"/> <outlet property="keyDerivationPopupButton" destination="5D9-bT-JAr" id="90K-97-HQW"/>
@@ -47,8 +48,8 @@
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/> <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="548" height="411"/> <rect key="contentRect" x="196" y="240" width="548" height="411"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/> <rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/>
<view key="contentView" misplaced="YES" id="2"> <view key="contentView" id="2">
<rect key="frame" x="0.0" y="0.0" width="548" height="411"/> <rect key="frame" x="0.0" y="0.0" width="548" height="335"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<subviews> <subviews>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="288"> <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="288">
@@ -78,7 +79,7 @@ Gw
</connections> </connections>
</button> </button>
<tabView translatesAutoresizingMaskIntoConstraints="NO" id="357"> <tabView translatesAutoresizingMaskIntoConstraints="NO" id="357">
<rect key="frame" x="13" y="41" width="522" height="282"/> <rect key="frame" x="13" y="41" width="522" height="288"/>
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
<tabViewItems> <tabViewItems>
<tabViewItem label="General" identifier="1" id="358"> <tabViewItem label="General" identifier="1" id="358">
@@ -156,7 +157,7 @@ Gw
<rect key="frame" x="1" y="1" width="278" height="98"/> <rect key="frame" x="1" y="1" width="278" height="98"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<textView importsGraphics="NO" usesFontPanel="YES" findStyle="panel" continuousSpellChecking="YES" allowsUndo="YES" usesRuler="YES" allowsNonContiguousLayout="YES" spellingCorrection="YES" smartInsertDelete="YES" id="1531"> <textView importsGraphics="NO" verticallyResizable="YES" usesFontPanel="YES" findStyle="panel" continuousSpellChecking="YES" allowsUndo="YES" usesRuler="YES" allowsNonContiguousLayout="YES" spellingCorrection="YES" smartInsertDelete="YES" id="1531">
<rect key="frame" x="0.0" y="0.0" width="278" height="98"/> <rect key="frame" x="0.0" y="0.0" width="278" height="98"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
@@ -423,25 +424,25 @@ Gw
</tabViewItem> </tabViewItem>
<tabViewItem label="Advanced" identifier="" id="368"> <tabViewItem label="Advanced" identifier="" id="368">
<view key="view" id="369"> <view key="view" id="369">
<rect key="frame" x="10" y="33" width="502" height="312"/> <rect key="frame" x="10" y="33" width="502" height="335"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<button verticalHuggingPriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="531"> <button verticalHuggingPriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="531">
<rect key="frame" x="70" y="276" width="145" height="18"/> <rect key="frame" x="70" y="299" width="145" height="18"/>
<buttonCell key="cell" type="check" title="Enable Entry History" bezelStyle="regularSquare" imagePosition="left" enabled="NO" state="on" inset="2" id="532"> <buttonCell key="cell" type="check" title="Enable Entry History" bezelStyle="regularSquare" imagePosition="left" enabled="NO" state="on" inset="2" id="532">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
</buttonCell> </buttonCell>
</button> </button>
<button translatesAutoresizingMaskIntoConstraints="NO" id="535"> <button translatesAutoresizingMaskIntoConstraints="NO" id="535">
<rect key="frame" x="70" y="178" width="137" height="18"/> <rect key="frame" x="70" y="201" width="137" height="18"/>
<buttonCell key="cell" type="check" title="Enable Recycle Bin" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="536"> <buttonCell key="cell" type="check" title="Enable Recycle Bin" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="536">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
</buttonCell> </buttonCell>
</button> </button>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="557"> <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="557">
<rect key="frame" x="110" y="251" width="103" height="17"/> <rect key="frame" x="110" y="274" width="103" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" enabled="NO" sendsActionOnEndEditing="YES" title="Maximum Items:" id="558"> <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" enabled="NO" sendsActionOnEndEditing="YES" title="Maximum Items:" id="558">
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -449,7 +450,7 @@ Gw
</textFieldCell> </textFieldCell>
</textField> </textField>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="593"> <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="593">
<rect key="frame" x="219" y="248" width="96" height="22"/> <rect key="frame" x="219" y="271" width="96" height="22"/>
<constraints> <constraints>
<constraint firstAttribute="width" constant="96" id="pYi-8G-RA7"/> <constraint firstAttribute="width" constant="96" id="pYi-8G-RA7"/>
</constraints> </constraints>
@@ -460,11 +461,11 @@ Gw
</textFieldCell> </textFieldCell>
</textField> </textField>
<stepper horizontalHuggingPriority="750" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="599"> <stepper horizontalHuggingPriority="750" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="599">
<rect key="frame" x="320" y="245" width="19" height="27"/> <rect key="frame" x="320" y="268" width="19" height="27"/>
<stepperCell key="cell" continuous="YES" enabled="NO" alignment="left" maxValue="100" id="600"/> <stepperCell key="cell" continuous="YES" enabled="NO" alignment="left" maxValue="100" id="600"/>
</stepper> </stepper>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="678"> <popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="678">
<rect key="frame" x="217" y="172" width="220" height="26"/> <rect key="frame" x="217" y="195" width="220" height="26"/>
<constraints> <constraints>
<constraint firstAttribute="width" constant="215" id="AIY-63-gl0"/> <constraint firstAttribute="width" constant="215" id="AIY-63-gl0"/>
</constraints> </constraints>
@@ -475,7 +476,7 @@ Gw
</popUpButtonCell> </popUpButtonCell>
</popUpButton> </popUpButton>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1268"> <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1268">
<rect key="frame" x="117" y="219" width="96" height="17"/> <rect key="frame" x="117" y="242" width="96" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" enabled="NO" sendsActionOnEndEditing="YES" title="Maximum Size:" id="1269"> <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" enabled="NO" sendsActionOnEndEditing="YES" title="Maximum Size:" id="1269">
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -483,7 +484,7 @@ Gw
</textFieldCell> </textFieldCell>
</textField> </textField>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1273"> <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1273">
<rect key="frame" x="219" y="216" width="96" height="22"/> <rect key="frame" x="219" y="239" width="96" height="22"/>
<constraints> <constraints>
<constraint firstAttribute="width" constant="96" id="lRA-HE-AaF"/> <constraint firstAttribute="width" constant="96" id="lRA-HE-AaF"/>
</constraints> </constraints>
@@ -494,11 +495,11 @@ Gw
</textFieldCell> </textFieldCell>
</textField> </textField>
<stepper horizontalHuggingPriority="750" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1294"> <stepper horizontalHuggingPriority="750" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1294">
<rect key="frame" x="320" y="213" width="19" height="27"/> <rect key="frame" x="320" y="236" width="19" height="27"/>
<stepperCell key="cell" continuous="YES" enabled="NO" alignment="left" maxValue="100" id="1295"/> <stepperCell key="cell" continuous="YES" enabled="NO" alignment="left" maxValue="100" id="1295"/>
</stepper> </stepper>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1582"> <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1582">
<rect key="frame" x="96" y="126" width="117" height="17"/> <rect key="frame" x="96" y="149" width="117" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Default Username:" id="1591"> <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Default Username:" id="1591">
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -506,7 +507,7 @@ Gw
</textFieldCell> </textFieldCell>
</textField> </textField>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1584"> <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1584">
<rect key="frame" x="108" y="85" width="105" height="17"/> <rect key="frame" x="108" y="108" width="105" height="17"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Template Group:" id="1588"> <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Template Group:" id="1588">
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -514,7 +515,7 @@ Gw
</textFieldCell> </textFieldCell>
</textField> </textField>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1730"> <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1730">
<rect key="frame" x="219" y="123" width="215" height="22"/> <rect key="frame" x="219" y="146" width="215" height="22"/>
<constraints> <constraints>
<constraint firstAttribute="width" constant="215" id="J2z-RZ-eS1"/> <constraint firstAttribute="width" constant="215" id="J2z-RZ-eS1"/>
</constraints> </constraints>
@@ -525,7 +526,7 @@ Gw
</textFieldCell> </textFieldCell>
</textField> </textField>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1738"> <popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1738">
<rect key="frame" x="217" y="79" width="220" height="26"/> <rect key="frame" x="217" y="102" width="220" height="26"/>
<constraints> <constraints>
<constraint firstAttribute="width" constant="215" id="5P2-dy-dfo"/> <constraint firstAttribute="width" constant="215" id="5P2-dy-dfo"/>
</constraints> </constraints>
@@ -542,21 +543,21 @@ Gw
</popUpButtonCell> </popUpButtonCell>
</popUpButton> </popUpButton>
<button verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Hqc-B0-xyz"> <button verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Hqc-B0-xyz">
<rect key="frame" x="70" y="54" width="211" height="18"/> <rect key="frame" x="70" y="77" width="211" height="18"/>
<buttonCell key="cell" type="check" title="Recommend key change every:" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="CtU-Eq-dgy"> <buttonCell key="cell" type="check" title="Recommend key change every:" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="CtU-Eq-dgy">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
</buttonCell> </buttonCell>
</button> </button>
<button translatesAutoresizingMaskIntoConstraints="NO" id="upv-b3-vCc"> <button translatesAutoresizingMaskIntoConstraints="NO" id="upv-b3-vCc">
<rect key="frame" x="70" y="22" width="211" height="18"/> <rect key="frame" x="70" y="45" width="211" height="18"/>
<buttonCell key="cell" type="check" title="Force key change every:" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="z6u-YT-7LE"> <buttonCell key="cell" type="check" title="Force key change every:" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="z6u-YT-7LE">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
</buttonCell> </buttonCell>
</button> </button>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="19r-LE-7X5"> <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="19r-LE-7X5">
<rect key="frame" x="287" y="52" width="38" height="22"/> <rect key="frame" x="287" y="75" width="38" height="22"/>
<constraints> <constraints>
<constraint firstAttribute="width" constant="38" id="Zyg-Bo-eBy"/> <constraint firstAttribute="width" constant="38" id="Zyg-Bo-eBy"/>
</constraints> </constraints>
@@ -567,7 +568,7 @@ Gw
</textFieldCell> </textFieldCell>
</textField> </textField>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="VYh-cm-fix"> <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="VYh-cm-fix">
<rect key="frame" x="287" y="20" width="38" height="22"/> <rect key="frame" x="287" y="43" width="38" height="22"/>
<constraints> <constraints>
<constraint firstAttribute="width" constant="38" id="hgc-dE-uYj"/> <constraint firstAttribute="width" constant="38" id="hgc-dE-uYj"/>
</constraints> </constraints>
@@ -578,20 +579,27 @@ Gw
</textFieldCell> </textFieldCell>
</textField> </textField>
<stepper horizontalHuggingPriority="750" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="GUO-6H-UI2"> <stepper horizontalHuggingPriority="750" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="GUO-6H-UI2">
<rect key="frame" x="330" y="49" width="19" height="27"/> <rect key="frame" x="330" y="72" width="19" height="27"/>
<stepperCell key="cell" continuous="YES" enabled="NO" alignment="left" maxValue="100" id="qQV-3d-GpK"/> <stepperCell key="cell" continuous="YES" enabled="NO" alignment="left" maxValue="100" id="qQV-3d-GpK"/>
</stepper> </stepper>
<stepper horizontalHuggingPriority="750" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="lH4-xp-5QF"> <stepper horizontalHuggingPriority="750" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="lH4-xp-5QF">
<rect key="frame" x="330" y="17" width="19" height="27"/> <rect key="frame" x="330" y="40" width="19" height="27"/>
<stepperCell key="cell" continuous="YES" enabled="NO" alignment="left" maxValue="100" id="7Hw-Qf-zWf"/> <stepperCell key="cell" continuous="YES" enabled="NO" alignment="left" maxValue="100" id="7Hw-Qf-zWf"/>
</stepper> </stepper>
<button verticalHuggingPriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="539"> <button verticalHuggingPriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="539">
<rect key="frame" x="110" y="151" width="182" height="18"/> <rect key="frame" x="110" y="174" width="182" height="18"/>
<buttonCell key="cell" type="check" title="Empty Recycle Bin on Quit" bezelStyle="regularSquare" imagePosition="left" enabled="NO" state="on" inset="2" id="540"> <buttonCell key="cell" type="check" title="Empty Recycle Bin on Quit" bezelStyle="regularSquare" imagePosition="left" enabled="NO" state="on" inset="2" id="540">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
</buttonCell> </buttonCell>
</button> </button>
<button translatesAutoresizingMaskIntoConstraints="NO" id="VMc-Qg-eCr">
<rect key="frame" x="70" y="18" width="257" height="18"/>
<buttonCell key="cell" type="check" title="Force key change once after unlocking" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="pA1-aL-KjT">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
</subviews> </subviews>
<constraints> <constraints>
<constraint firstItem="GUO-6H-UI2" firstAttribute="centerY" secondItem="19r-LE-7X5" secondAttribute="centerY" id="0fF-mc-ILf"/> <constraint firstItem="GUO-6H-UI2" firstAttribute="centerY" secondItem="19r-LE-7X5" secondAttribute="centerY" id="0fF-mc-ILf"/>
@@ -612,17 +620,19 @@ Gw
<constraint firstItem="VYh-cm-fix" firstAttribute="leading" secondItem="upv-b3-vCc" secondAttribute="trailing" constant="8" symbolic="YES" id="Gvz-cw-gyJ"/> <constraint firstItem="VYh-cm-fix" firstAttribute="leading" secondItem="upv-b3-vCc" secondAttribute="trailing" constant="8" symbolic="YES" id="Gvz-cw-gyJ"/>
<constraint firstItem="535" firstAttribute="baseline" secondItem="678" secondAttribute="baseline" id="IOP-Cc-JfA"/> <constraint firstItem="535" firstAttribute="baseline" secondItem="678" secondAttribute="baseline" id="IOP-Cc-JfA"/>
<constraint firstItem="1273" firstAttribute="baseline" secondItem="1268" secondAttribute="baseline" id="KbL-8w-fEa"/> <constraint firstItem="1273" firstAttribute="baseline" secondItem="1268" secondAttribute="baseline" id="KbL-8w-fEa"/>
<constraint firstAttribute="bottom" secondItem="VYh-cm-fix" secondAttribute="bottom" constant="20" symbolic="YES" id="KhB-xv-Y6e"/>
<constraint firstItem="1738" firstAttribute="leading" secondItem="1584" secondAttribute="trailing" constant="8" id="Mvn-4e-Z7D"/> <constraint firstItem="1738" firstAttribute="leading" secondItem="1584" secondAttribute="trailing" constant="8" id="Mvn-4e-Z7D"/>
<constraint firstItem="531" firstAttribute="leading" secondItem="Hqc-B0-xyz" secondAttribute="leading" id="Nxh-YG-snR"/> <constraint firstItem="531" firstAttribute="leading" secondItem="Hqc-B0-xyz" secondAttribute="leading" id="Nxh-YG-snR"/>
<constraint firstItem="1273" firstAttribute="top" secondItem="593" secondAttribute="bottom" constant="10" symbolic="YES" id="QhO-OW-itG"/> <constraint firstItem="1273" firstAttribute="top" secondItem="593" secondAttribute="bottom" constant="10" symbolic="YES" id="QhO-OW-itG"/>
<constraint firstItem="531" firstAttribute="leading" secondItem="369" secondAttribute="leading" constant="72" id="ToY-AF-7CZ"/> <constraint firstItem="531" firstAttribute="leading" secondItem="369" secondAttribute="leading" constant="72" id="ToY-AF-7CZ"/>
<constraint firstItem="531" firstAttribute="leading" secondItem="upv-b3-vCc" secondAttribute="leading" id="UKO-82-vrB"/> <constraint firstItem="531" firstAttribute="leading" secondItem="upv-b3-vCc" secondAttribute="leading" id="UKO-82-vrB"/>
<constraint firstAttribute="bottom" secondItem="VMc-Qg-eCr" secondAttribute="bottom" constant="20" symbolic="YES" id="UVL-oZ-gGY"/>
<constraint firstItem="VMc-Qg-eCr" firstAttribute="top" secondItem="VYh-cm-fix" secondAttribute="bottom" constant="9" id="WDt-qR-mMT"/>
<constraint firstItem="593" firstAttribute="leading" secondItem="557" secondAttribute="trailing" constant="8" id="bgR-yS-2b7"/> <constraint firstItem="593" firstAttribute="leading" secondItem="557" secondAttribute="trailing" constant="8" id="bgR-yS-2b7"/>
<constraint firstItem="1730" firstAttribute="top" secondItem="539" secondAttribute="bottom" constant="8" symbolic="YES" id="bkx-0b-opr"/> <constraint firstItem="1730" firstAttribute="top" secondItem="539" secondAttribute="bottom" constant="8" symbolic="YES" id="bkx-0b-opr"/>
<constraint firstItem="1730" firstAttribute="leading" secondItem="678" secondAttribute="leading" id="cgb-Lx-8GP"/> <constraint firstItem="1730" firstAttribute="leading" secondItem="678" secondAttribute="leading" id="cgb-Lx-8GP"/>
<constraint firstItem="1294" firstAttribute="centerY" secondItem="1273" secondAttribute="centerY" id="cpr-BN-2DZ"/> <constraint firstItem="1294" firstAttribute="centerY" secondItem="1273" secondAttribute="centerY" id="cpr-BN-2DZ"/>
<constraint firstItem="19r-LE-7X5" firstAttribute="top" secondItem="1738" secondAttribute="bottom" constant="8" symbolic="YES" id="dM9-Fh-j6y"/> <constraint firstItem="19r-LE-7X5" firstAttribute="top" secondItem="1738" secondAttribute="bottom" constant="8" symbolic="YES" id="dM9-Fh-j6y"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="VMc-Qg-eCr" secondAttribute="trailing" constant="20" symbolic="YES" id="eAd-MK-G1o"/>
<constraint firstItem="557" firstAttribute="baseline" secondItem="593" secondAttribute="baseline" id="edx-L7-RYQ"/> <constraint firstItem="557" firstAttribute="baseline" secondItem="593" secondAttribute="baseline" id="edx-L7-RYQ"/>
<constraint firstItem="1584" firstAttribute="baseline" secondItem="1738" secondAttribute="baseline" id="fEL-DR-qHv"/> <constraint firstItem="1584" firstAttribute="baseline" secondItem="1738" secondAttribute="baseline" id="fEL-DR-qHv"/>
<constraint firstItem="19r-LE-7X5" firstAttribute="leading" secondItem="Hqc-B0-xyz" secondAttribute="trailing" constant="8" symbolic="YES" id="fVi-fB-ndY"/> <constraint firstItem="19r-LE-7X5" firstAttribute="leading" secondItem="Hqc-B0-xyz" secondAttribute="trailing" constant="8" symbolic="YES" id="fVi-fB-ndY"/>
@@ -636,6 +646,7 @@ Gw
<constraint firstItem="VYh-cm-fix" firstAttribute="leading" secondItem="19r-LE-7X5" secondAttribute="leading" id="tmY-iX-cZh"/> <constraint firstItem="VYh-cm-fix" firstAttribute="leading" secondItem="19r-LE-7X5" secondAttribute="leading" id="tmY-iX-cZh"/>
<constraint firstItem="531" firstAttribute="leading" secondItem="535" secondAttribute="leading" id="ucf-w0-brS"/> <constraint firstItem="531" firstAttribute="leading" secondItem="535" secondAttribute="leading" id="ucf-w0-brS"/>
<constraint firstItem="1738" firstAttribute="top" secondItem="1730" secondAttribute="bottom" constant="20" symbolic="YES" id="wPN-zn-tg4"/> <constraint firstItem="1738" firstAttribute="top" secondItem="1730" secondAttribute="bottom" constant="20" symbolic="YES" id="wPN-zn-tg4"/>
<constraint firstItem="VMc-Qg-eCr" firstAttribute="leading" secondItem="531" secondAttribute="leading" id="zl6-Bu-eJC"/>
</constraints> </constraints>
</view> </view>
</tabViewItem> </tabViewItem>
@@ -653,7 +664,7 @@ Gw
<constraint firstItem="956" firstAttribute="top" secondItem="357" secondAttribute="bottom" constant="10" id="1096"/> <constraint firstItem="956" firstAttribute="top" secondItem="357" secondAttribute="bottom" constant="10" id="1096"/>
</constraints> </constraints>
</view> </view>
<point key="canvasLocation" x="-104" y="1"/> <point key="canvasLocation" x="-570" y="-191"/>
</window> </window>
</objects> </objects>
</document> </document>

View File

@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="12120" systemVersion="16F73" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES"> <document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="13196" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies> <dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="12120"/> <deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13196"/>
<capability name="box content view" minToolsVersion="7.0"/> <capability name="box content view" minToolsVersion="7.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies> </dependencies>
@@ -33,7 +34,7 @@
<font key="font" metaFont="system"/> <font key="font" metaFont="system"/>
</buttonCell> </buttonCell>
</button> </button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="aoG-FD-ds8"> <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" setsMaxLayoutWidthAtFirstLayout="YES" translatesAutoresizingMaskIntoConstraints="NO" id="aoG-FD-ds8">
<rect key="frame" x="18" y="364" width="484" height="28"/> <rect key="frame" x="18" y="364" width="484" height="28"/>
<textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" id="2bX-8S-9XM"> <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" id="2bX-8S-9XM">
<font key="font" metaFont="smallSystem"/> <font key="font" metaFont="smallSystem"/>
@@ -72,7 +73,7 @@
<rect key="frame" x="1" y="1" width="145" height="17"/> <rect key="frame" x="1" y="1" width="145" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="q1P-PD-0LW"> <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="q1P-PD-0LW">
<rect key="frame" x="0.0" y="0.0" width="100" height="17"/> <rect key="frame" x="0.0" y="0.0" width="100" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="fug-79-n9g"> <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="fug-79-n9g">
@@ -112,6 +113,7 @@
<constraint firstAttribute="trailing" secondItem="aoG-FD-ds8" secondAttribute="trailing" constant="20" symbolic="YES" id="95O-Jh-0KG"/> <constraint firstAttribute="trailing" secondItem="aoG-FD-ds8" secondAttribute="trailing" constant="20" symbolic="YES" id="95O-Jh-0KG"/>
<constraint firstAttribute="trailing" secondItem="vBs-Ga-aq0" secondAttribute="trailing" constant="20" id="LUb-Un-azV"/> <constraint firstAttribute="trailing" secondItem="vBs-Ga-aq0" secondAttribute="trailing" constant="20" id="LUb-Un-azV"/>
<constraint firstItem="aoG-FD-ds8" firstAttribute="leading" secondItem="CqP-oK-S8k" secondAttribute="leading" id="NcW-ya-DPx"/> <constraint firstItem="aoG-FD-ds8" firstAttribute="leading" secondItem="CqP-oK-S8k" secondAttribute="leading" id="NcW-ya-DPx"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="CqP-oK-S8k" secondAttribute="trailing" constant="20" symbolic="YES" id="TXL-mf-nxu"/>
<constraint firstAttribute="bottom" secondItem="fCk-fL-jU8" secondAttribute="bottom" constant="20" id="aeb-kZ-RSU"/> <constraint firstAttribute="bottom" secondItem="fCk-fL-jU8" secondAttribute="bottom" constant="20" id="aeb-kZ-RSU"/>
<constraint firstAttribute="bottom" secondItem="vBs-Ga-aq0" secondAttribute="bottom" constant="20" id="czn-HC-o7k"/> <constraint firstAttribute="bottom" secondItem="vBs-Ga-aq0" secondAttribute="bottom" constant="20" id="czn-HC-o7k"/>
<constraint firstItem="fCk-fL-jU8" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="20" id="fzW-4b-L8S"/> <constraint firstItem="fCk-fL-jU8" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="20" id="fzW-4b-L8S"/>
@@ -120,7 +122,7 @@
<constraint firstItem="vBs-Ga-aq0" firstAttribute="leading" secondItem="fCk-fL-jU8" secondAttribute="trailing" constant="8" id="xNu-Sj-xQO"/> <constraint firstItem="vBs-Ga-aq0" firstAttribute="leading" secondItem="fCk-fL-jU8" secondAttribute="trailing" constant="8" id="xNu-Sj-xQO"/>
<constraint firstItem="aoG-FD-ds8" firstAttribute="top" secondItem="CqP-oK-S8k" secondAttribute="bottom" constant="8" symbolic="YES" id="zSW-h3-BrT"/> <constraint firstItem="aoG-FD-ds8" firstAttribute="top" secondItem="CqP-oK-S8k" secondAttribute="bottom" constant="8" symbolic="YES" id="zSW-h3-BrT"/>
</constraints> </constraints>
<point key="canvasLocation" x="-174" y="134"/> <point key="canvasLocation" x="108" y="118"/>
</customView> </customView>
</objects> </objects>
</document> </document>

View File

@@ -67,6 +67,7 @@ typedef NS_ENUM(NSUInteger, MPDatabaseSettingsTab) {
@property (weak) IBOutlet NSButton *recommendKeyChangeCheckButton; @property (weak) IBOutlet NSButton *recommendKeyChangeCheckButton;
@property (weak) IBOutlet NSButton *enforceKeyChangeCheckButton; @property (weak) IBOutlet NSButton *enforceKeyChangeCheckButton;
@property (weak) IBOutlet NSButton *enforceKeyChangeOnceCheckButton;
@property (weak) IBOutlet NSTextField *recommendKeyChangeIntervalTextField; @property (weak) IBOutlet NSTextField *recommendKeyChangeIntervalTextField;
@property (weak) IBOutlet NSTextField *enforceKeyChangeIntervalTextField; @property (weak) IBOutlet NSTextField *enforceKeyChangeIntervalTextField;

View File

@@ -37,6 +37,8 @@
@interface MPDatabaseSettingsWindowController () { @interface MPDatabaseSettingsWindowController () {
NSString *_missingFeature; NSString *_missingFeature;
} }
@property (assign) BOOL enableHistory;
@end @end
@implementation MPDatabaseSettingsWindowController @implementation MPDatabaseSettingsWindowController
@@ -80,6 +82,9 @@
self.cipherPopupButton.menu = cipherMenu; self.cipherPopupButton.menu = cipherMenu;
self.keyDerivationSettingsTabView.tabViewItems[0].identifier = [KPKAESKeyDerivation uuid]; self.keyDerivationSettingsTabView.tabViewItems[0].identifier = [KPKAESKeyDerivation uuid];
self.keyDerivationSettingsTabView.tabViewItems[1].identifier = [KPKArgon2KeyDerivation uuid]; self.keyDerivationSettingsTabView.tabViewItems[1].identifier = [KPKArgon2KeyDerivation uuid];
} }
#pragma mark Actions #pragma mark Actions
@@ -113,11 +118,23 @@
KPKGroup *trashGroup = trashMenuItem.representedObject; KPKGroup *trashGroup = trashMenuItem.representedObject;
((MPDocument *)self.document).tree.trash = trashGroup; ((MPDocument *)self.document).tree.trash = trashGroup;
BOOL requiresHistoryMaintainance = NO;
requiresHistoryMaintainance = (metaData.historyMaxSize > self.historyMaxiumSizeTextField.integerValue ||
metaData.historyMaxItems > self.historyMaximumItemsTextField.integerValue);
metaData.historyMaxItems = self.historyMaximumItemsTextField.integerValue;
metaData.historyMaxSize = self.historyMaxiumSizeTextField.integerValue;
/* only maintain history if actually needed */
if(requiresHistoryMaintainance) {
KPKTree *tree = ((MPDocument *)self.document).tree;
[tree maintainHistory];
}
NSMenuItem *templateMenuItem = self.templateGroupPopUpButton.selectedItem; NSMenuItem *templateMenuItem = self.templateGroupPopUpButton.selectedItem;
KPKGroup *templateGroup = templateMenuItem.representedObject; KPKGroup *templateGroup = templateMenuItem.representedObject;
((MPDocument *)self.document).templates = templateGroup; ((MPDocument *)self.document).templates = templateGroup;
BOOL enforceMasterKeyChange = HNHUIBoolForState(self.enforceKeyChangeCheckButton.state); BOOL enforceMasterKeyChange = HNHUIBoolForState(self.enforceKeyChangeCheckButton.state);
BOOL recommendMasterKeyChange = HNHUIBoolForState(self.recommendKeyChangeCheckButton.state); BOOL recommendMasterKeyChange = HNHUIBoolForState(self.recommendKeyChangeCheckButton.state);
@@ -129,6 +146,7 @@
metaData.masterKeyChangeEnforcementInterval = enforceMasterKeyChange ? enfoceInterval : -1; metaData.masterKeyChangeEnforcementInterval = enforceMasterKeyChange ? enfoceInterval : -1;
metaData.masterKeyChangeRecommendationInterval = recommendMasterKeyChange ? recommendInterval : -1; metaData.masterKeyChangeRecommendationInterval = recommendMasterKeyChange ? recommendInterval : -1;
metaData.enforceMasterKeyChangeOnce = HNHUIBoolForState(self.enforceKeyChangeOnceCheckButton.state);
metaData.defaultUserName = self.defaultUsernameTextField.stringValue; metaData.defaultUserName = self.defaultUsernameTextField.stringValue;
@@ -257,17 +275,27 @@
} }
- (void)_setupAdvancedTab:(KPKTree *)tree { - (void)_setupAdvancedTab:(KPKTree *)tree {
HNHUISetStateFromBool(self.enableTrashCheckButton, tree.metaData.useTrash); /* history */
self.selectTrashGoupPopUpButton.enabled = tree.metaData.useTrash; self.enableHistory = tree.metaData.isHistoryEnabled;
[self.enableHistoryCheckButton bind:NSValueBinding toObject:self withKeyPath:NSStringFromSelector(@selector(enableHistory)) options:nil];
self.historyMaximumItemsTextField.stringValue = [NSString stringWithFormat:@"%ld", tree.metaData.historyMaxItems]; self.historyMaximumItemsTextField.stringValue = [NSString stringWithFormat:@"%ld", tree.metaData.historyMaxItems];
self.historyMaxiumSizeTextField.stringValue = [NSString stringWithFormat:@"%ld", tree.metaData.historyMaxSize]; self.historyMaxiumSizeTextField.stringValue = [NSString stringWithFormat:@"%ld", tree.metaData.historyMaxSize];
[self.historyMaximumItemsTextField bind:NSEnabledBinding toObject:self withKeyPath:NSStringFromSelector(@selector(enableHistory)) options:nil];
[self.historyMaxiumSizeTextField bind:NSEnabledBinding toObject:self withKeyPath:NSStringFromSelector(@selector(enableHistory)) options:nil];
/* trash */
HNHUISetStateFromBool(self.enableTrashCheckButton, tree.metaData.useTrash);
self.selectTrashGoupPopUpButton.enabled = tree.metaData.useTrash;
[self.enableTrashCheckButton bind:NSValueBinding toObject:self.selectTrashGoupPopUpButton withKeyPath:NSEnabledBinding options:nil]; [self.enableTrashCheckButton bind:NSValueBinding toObject:self.selectTrashGoupPopUpButton withKeyPath:NSEnabledBinding options:nil];
[self _updateTrashFolders:tree]; [self _updateTrashFolders:tree];
/* default username */
self.defaultUsernameTextField.stringValue = tree.metaData.defaultUserName; self.defaultUsernameTextField.stringValue = tree.metaData.defaultUserName;
self.defaultUsernameTextField.editable = YES; self.defaultUsernameTextField.editable = YES;
[self _updateTemplateGroup:tree]; [self _updateTemplateGroup:tree];
/* key changes */
HNHUISetStateFromBool(self.enforceKeyChangeOnceCheckButton, tree.metaData.enforceMasterKeyChangeOnce);
HNHUISetStateFromBool(self.enforceKeyChangeCheckButton, tree.metaData.enforceMasterKeyChange); HNHUISetStateFromBool(self.enforceKeyChangeCheckButton, tree.metaData.enforceMasterKeyChange);
HNHUISetStateFromBool(self.recommendKeyChangeCheckButton, tree.metaData.recommendMasterKeyChange); HNHUISetStateFromBool(self.recommendKeyChangeCheckButton, tree.metaData.recommendMasterKeyChange);
[self.enforceKeyChangeIntervalTextField setEnabled:tree.metaData.enforceMasterKeyChange]; [self.enforceKeyChangeIntervalTextField setEnabled:tree.metaData.enforceMasterKeyChange];

View File

@@ -146,8 +146,8 @@ FOUNDATION_EXPORT NSString *const MPDocumentGroupKey;
- (NSArray *)allEntries; - (NSArray *)allEntries;
- (NSArray *)allGroups; - (NSArray *)allGroups;
- (BOOL)shouldRecommendPasswordChange;
- (BOOL)shouldEnforcePasswordChange; - (BOOL)shouldEnforcePasswordChange;
- (BOOL)shouldRecommendPasswordChange;
- (void)writeXMLToURL:(NSURL *)url; - (void)writeXMLToURL:(NSURL *)url;
- (void)readXMLfromURL:(NSURL *)url; - (void)readXMLfromURL:(NSURL *)url;

View File

@@ -581,13 +581,20 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGrou
- (BOOL)shouldEnforcePasswordChange { - (BOOL)shouldEnforcePasswordChange {
KPKMetaData *metaData = self.tree.metaData; KPKMetaData *metaData = self.tree.metaData;
if(!metaData.enforceMasterKeyChange) { return NO; } if(metaData.enforceMasterKeyChangeOnce) {
return YES;
}
if(!metaData.enforceMasterKeyChange) {
return NO;
}
return ((24*60*60*metaData.masterKeyChangeEnforcementInterval) < -[metaData.masterKeyChanged timeIntervalSinceNow]); return ((24*60*60*metaData.masterKeyChangeEnforcementInterval) < -[metaData.masterKeyChanged timeIntervalSinceNow]);
} }
- (BOOL)shouldRecommendPasswordChange { - (BOOL)shouldRecommendPasswordChange {
KPKMetaData *metaData = self.tree.metaData; KPKMetaData *metaData = self.tree.metaData;
if(!metaData.recommendMasterKeyChange) { return NO; } if(!metaData.recommendMasterKeyChange) {
return NO;
}
return ( (24*60*60*metaData.masterKeyChangeRecommendationInterval) < -[metaData.masterKeyChanged timeIntervalSinceNow]); return ( (24*60*60*metaData.masterKeyChangeRecommendationInterval) < -[metaData.masterKeyChanged timeIntervalSinceNow]);
} }

View File

@@ -218,15 +218,6 @@ typedef void (^MPPasswordChangedBlock)(BOOL didChangePassword);
}]; }];
return; return;
} }
else if(document.shouldEnforcePasswordChange) {
[self editPasswordWithCompetionHandler:^(NSInteger result) {
if(result == NSModalResponseOK) {
[self saveDocument:sender];
}
}];
[self _presentPasswordIntervalAlerts];
return;
}
/* All set and good ready to save */ /* All set and good ready to save */
[self.document saveDocument:sender]; [self.document saveDocument:sender];
} }
@@ -515,7 +506,7 @@ typedef void (^MPPasswordChangedBlock)(BOOL didChangePassword);
#pragma mark NSAlert handling #pragma mark NSAlert handling
- (void)_presentPasswordIntervalAlerts { - (void)_presentPasswordIntervalAlerts {
MPDocument *document = [self document]; MPDocument *document = self.document;
if(document.shouldEnforcePasswordChange) { if(document.shouldEnforcePasswordChange) {
NSAlert *alert = [[NSAlert alloc] init]; NSAlert *alert = [[NSAlert alloc] init];
@@ -524,15 +515,17 @@ typedef void (^MPPasswordChangedBlock)(BOOL didChangePassword);
alert.informativeText = NSLocalizedString(@"ENFORCE_PASSWORD_CHANGE_ALERT_DESCRIPTION", ""); alert.informativeText = NSLocalizedString(@"ENFORCE_PASSWORD_CHANGE_ALERT_DESCRIPTION", "");
[alert addButtonWithTitle:NSLocalizedString(@"CHANGE_PASSWORD_WITH_DOTS", "")]; [alert addButtonWithTitle:NSLocalizedString(@"CHANGE_PASSWORD_WITH_DOTS", "")];
[alert addButtonWithTitle:NSLocalizedString(@"CANCEL", "")];
alert.buttons[1].keyEquivalent = [NSString stringWithFormat:@"%c", 0x1b];
[alert beginSheetModalForWindow:[self.document windowForSheet] completionHandler:^(NSModalResponse returnCode) { [alert beginSheetModalForWindow:[self.document windowForSheet] completionHandler:^(NSModalResponse returnCode) {
if(NSAlertSecondButtonReturn == returnCode) {
return;
}
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self editPassword:nil]; [self editPasswordWithCompetionHandler:^(NSInteger result) {
/* if password was changed, reset change key and dismiss */
if(NSModalResponseOK == result) {
document.tree.metaData.enforceMasterKeyChangeOnce = NO;
}
/* password was not changes, so keep nagging the user! */
[self _presentPasswordIntervalAlerts];
}];
}); });
}]; }];
} }