Skip to content

Commit

Permalink
tweaked prefs
Browse files Browse the repository at this point in the history
  • Loading branch information
twocanoes committed Jun 5, 2022
1 parent ee6c77c commit 26bd973
Show file tree
Hide file tree
Showing 11 changed files with 91 additions and 59 deletions.
11 changes: 11 additions & 0 deletions XCreds/Credits.rtf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{\rtf1\ansi\ansicpg1252\cocoartf2638
\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
{\*\expandedcolortbl;;}
\margl1440\margr1440\vieww11520\viewh8400\viewkind0
\pard\tx720\tx1130\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\qc\partightenfactor0

\f0\fs24 \cf0 Special thanks to North Carolina State University for initial funding of this project. XCreds is licensed under BSD Open Source License.\
\
{\field{\*\fldinst{HYPERLINK "https://twocanoes.com"}}{\fldrslt https://twocanoes.com}}\
}
6 changes: 3 additions & 3 deletions XCreds/MainMenu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ class MainMenu: NSObject, NSMenuDelegate {
mainMenu.removeAllItems()

// add menu items
let aboutMenuItem = NSMenuItem(title: "About", action:#selector(NSApp.orderFrontStandardAboutPanel(_:)), keyEquivalent: "")
let quitMenuItem = NSMenuItem(title: "Quit", action:#selector(NSApp.terminate(_:)), keyEquivalent: "")


mainMenu.addItem(AboutMenuItem())
mainMenu.addItem(NSMenuItem.separator())
mainMenu.addItem(SignInMenuItem())
mainMenu.addItem(CheckTokenMenuItem())
mainMenu.addItem(PrefsMenuItem())
mainMenu.addItem(aboutMenuItem)
mainMenu.addItem(NSMenuItem.separator())
mainMenu.addItem(quitMenuItem)

}
Expand Down
48 changes: 35 additions & 13 deletions XCreds/PreferencesWindow.xib
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<userDefaultsController representsSharedInstance="YES" id="5Ar-2a-lNk"/>
<window title="Preferences" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="e3r-XM-xJP">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<window title="Preferences" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="e3r-XM-xJP">
<windowStyleMask key="styleMask" titled="YES" closable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="480" height="139"/>
<rect key="contentRect" x="560" y="551" width="494" height="173"/>
<rect key="screenRect" x="0.0" y="0.0" width="1536" height="935"/>
<view key="contentView" wantsLayer="YES" id="ZbF-tC-vpZ">
<rect key="frame" x="0.0" y="0.0" width="480" height="139"/>
<rect key="frame" x="0.0" y="0.0" width="494" height="173"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="h4y-Ta-Cvg">
<rect key="frame" x="23" y="116" width="90" height="16"/>
<rect key="frame" x="23" y="150" width="90" height="16"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="DiscoveryURL" id="lS2-NV-sCW">
<font key="font" usesAppearanceFont="YES"/>
Expand All @@ -32,7 +32,7 @@
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="B0L-lU-7n3">
<rect key="frame" x="57" y="89" width="56" height="16"/>
<rect key="frame" x="57" y="123" width="56" height="16"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Client ID" id="JyJ-Id-S9x">
<font key="font" usesAppearanceFont="YES"/>
Expand All @@ -41,7 +41,7 @@
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="cBA-rI-7yf">
<rect key="frame" x="119" y="113" width="341" height="21"/>
<rect key="frame" x="119" y="147" width="355" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" id="9Si-gZ-wo5">
<font key="font" metaFont="system"/>
Expand All @@ -57,7 +57,7 @@
</connections>
</textField>
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Ie3-c5-0dg">
<rect key="frame" x="119" y="89" width="341" height="21"/>
<rect key="frame" x="119" y="123" width="355" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" id="pgf-ba-xBF">
<font key="font" metaFont="system"/>
Expand All @@ -84,7 +84,7 @@
</connections>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="6cE-Yr-0bd">
<rect key="frame" x="23" y="62" width="210" height="16"/>
<rect key="frame" x="23" y="96" width="210" height="16"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Check for password change every" id="bZ8-Xb-oG5">
<font key="font" metaFont="system"/>
Expand All @@ -93,7 +93,7 @@
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="exK-od-VQg">
<rect key="frame" x="239" y="59" width="51" height="21"/>
<rect key="frame" x="239" y="93" width="51" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" id="oP1-XG-OoD">
<font key="font" metaFont="system"/>
Expand All @@ -109,17 +109,39 @@
</connections>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Yzp-d3-Q7K">
<rect key="frame" x="296" y="62" width="56" height="16"/>
<rect key="frame" x="296" y="96" width="56" height="16"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="seconds" id="R3c-k5-x0H">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="VNl-22-uJH">
<rect key="frame" x="23" y="71" width="217" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" title="Show Debug Push Notifications" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="dRK-Of-hFQ">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<binding destination="5Ar-2a-lNk" name="value" keyPath="values.showDebug" id="p8B-ky-oMA"/>
</connections>
</button>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="SZG-WX-diX">
<rect key="frame" x="23" y="49" width="451" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" title="Require Cloud Password Confirmation before changing local password" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="369-w0-EY8">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<binding destination="5Ar-2a-lNk" name="value" keyPath="values.verifyPassword" id="SKG-85-tJm"/>
</connections>
</button>
</subviews>
</view>
<point key="canvasLocation" x="119" y="190.5"/>
<point key="canvasLocation" x="191" y="192"/>
</window>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="dXE-Xt-nIV">
<rect key="frame" x="0.0" y="0.0" width="90" height="16"/>
Expand All @@ -129,7 +151,7 @@
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<point key="canvasLocation" x="10" y="367"/>
<point key="canvasLocation" x="49" y="340"/>
</textField>
</objects>
</document>
8 changes: 5 additions & 3 deletions XCreds/PreferencesWindowController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ class PreferencesWindowController: NSWindowController {
}

@IBAction func clearTokensClicked(_ sender: Any) {
UserDefaults.standard.set(nil, forKey: PrefKeys.accessToken.rawValue)
UserDefaults.standard.set(nil, forKey: PrefKeys.idToken.rawValue)
UserDefaults.standard.set(nil, forKey: PrefKeys.refreshToken.rawValue)
let keychainUtil = KeychainUtil()
let _ = keychainUtil.findAndDelete(PrefKeys.accessToken.rawValue)
let _ = keychainUtil.findAndDelete(PrefKeys.idToken.rawValue)
let _ = keychainUtil.findAndDelete(PrefKeys.refreshToken.rawValue)

}

}
8 changes: 4 additions & 4 deletions XCreds/ScheduleManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ class ScheduleManager {
NotifyManager.shared.sendMessage(message: "Azure password changed or not set")
}
DispatchQueue.main.async {
mainMenu.webView = WebViewController()
mainMenu.webView?.window!.forceToFrontAndFocus(nil)
mainMenu.webView?.run()

// mainMenu.webView = WebViewController()
// mainMenu.webView?.window!.forceToFrontAndFocus(nil)
// mainMenu.webView?.run()
SignInMenuItem().doAction()
}

}
Expand Down
14 changes: 11 additions & 3 deletions XCreds/SignInMenuItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,16 @@ class SignInMenuItem: NSMenuItem {

@objc func doAction() {

mainMenu.webView = WebViewController()
mainMenu.webView?.window!.forceToFrontAndFocus(nil)
mainMenu.webView?.run()
if UserDefaults.standard.value(forKey: PrefKeys.discoveryURL.rawValue) != nil && UserDefaults.standard.value(forKey: PrefKeys.clientID.rawValue) != nil {
if (mainMenu.webView==nil){
mainMenu.webView = WebViewController()
}
mainMenu.webView?.window!.forceToFrontAndFocus(nil)
mainMenu.webView?.run()
}
else {

PrefsMenuItem().doAction()
}
}
}
1 change: 1 addition & 0 deletions XCreds/WebView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ extension WebViewController: WKNavigationDelegate {

return dictionary
}

}

extension WebViewController: OIDCLiteDelegate {
Expand Down
20 changes: 9 additions & 11 deletions XCreds/WebView.xib
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,21 @@
<window title="Sign In" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="KxT-zM-Vnn">
<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="628" height="613"/>
<rect key="contentRect" x="453" y="250" width="628" height="613"/>
<rect key="screenRect" x="0.0" y="0.0" width="1536" height="935"/>
<view key="contentView" wantsLayer="YES" id="2LH-tE-efn">
<rect key="frame" x="0.0" y="0.0" width="628" height="613"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<wkWebView wantsLayer="YES" translatesAutoresizingMaskIntoConstraints="NO" id="p1x-1L-05D">
<rect key="frame" x="0.0" y="64" width="628" height="555"/>
<constraints>
<constraint firstAttribute="width" constant="628" id="RJ9-kb-xRi"/>
<constraint firstAttribute="height" constant="555" id="idm-c7-eyh"/>
</constraints>
<rect key="frame" x="0.0" y="64" width="628" height="549"/>
<wkWebViewConfiguration key="configuration">
<audiovisualMediaTypes key="mediaTypesRequiringUserActionForPlayback" none="YES"/>
<wkPreferences key="preferences"/>
</wkWebViewConfiguration>
</wkWebView>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="k1y-g2-hDK">
<rect key="frame" x="276" y="17" width="76" height="32"/>
<rect key="frame" x="539" y="13" width="76" height="32"/>
<buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="ksj-eV-tj1">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
Expand All @@ -50,10 +46,12 @@ Gw
</button>
</subviews>
<constraints>
<constraint firstAttribute="bottom" secondItem="p1x-1L-05D" secondAttribute="bottom" constant="64" id="9PT-Ry-kTm"/>
<constraint firstAttribute="bottom" secondItem="k1y-g2-hDK" secondAttribute="bottom" constant="24" id="ATg-sW-cni"/>
<constraint firstItem="p1x-1L-05D" firstAttribute="centerX" secondItem="k1y-g2-hDK" secondAttribute="centerX" id="V0g-Vn-36f"/>
<constraint firstItem="k1y-g2-hDK" firstAttribute="centerX" secondItem="2LH-tE-efn" secondAttribute="centerX" id="cLg-fL-hLA"/>
<constraint firstAttribute="trailing" secondItem="p1x-1L-05D" secondAttribute="trailing" id="3Xb-lz-75r"/>
<constraint firstAttribute="trailing" secondItem="k1y-g2-hDK" secondAttribute="trailing" constant="20" symbolic="YES" id="7i7-Zq-FS8"/>
<constraint firstAttribute="bottom" secondItem="k1y-g2-hDK" secondAttribute="bottom" constant="20" symbolic="YES" id="S7Q-4g-cc3"/>
<constraint firstItem="k1y-g2-hDK" firstAttribute="top" secondItem="p1x-1L-05D" secondAttribute="bottom" constant="24" id="bK2-wq-WpJ"/>
<constraint firstItem="p1x-1L-05D" firstAttribute="leading" secondItem="2LH-tE-efn" secondAttribute="leading" id="ejy-F7-Axt"/>
<constraint firstItem="p1x-1L-05D" firstAttribute="top" secondItem="2LH-tE-efn" secondAttribute="top" id="gmG-FO-hZc"/>
</constraints>
</view>
<point key="canvasLocation" x="142" y="302.5"/>
Expand Down
Loading

0 comments on commit 26bd973

Please sign in to comment.