forked from twocanoes/xcreds
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added verification and refactored dialogs
- Loading branch information
Showing
10 changed files
with
250 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// | ||
// LoginPasswordWindowController.swift | ||
// XCreds | ||
// | ||
// Created by Timothy Perfitt on 6/4/22. | ||
// | ||
|
||
import Cocoa | ||
|
||
class LoginPasswordWindowController: NSWindowController { | ||
|
||
@IBOutlet weak var passwordTextField: NSSecureTextField! | ||
|
||
var password:String? | ||
override func windowDidLoad() { | ||
super.windowDidLoad() | ||
|
||
// Implement this method to handle any initialization after your window controller's window has been loaded from its nib file. | ||
} | ||
|
||
@IBAction func updateButtonPressed(_ sender: Any) { | ||
if self.window?.isModalPanel==true { | ||
password=passwordTextField.stringValue | ||
NSApp.stopModal(withCode: .OK) | ||
|
||
} | ||
} | ||
@IBAction func cancelButtonPressed(_ sender: Any) { | ||
if self.window?.isModalPanel==true { | ||
NSApp.stopModal(withCode: .cancel) | ||
self.window?.close() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="20037" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct"> | ||
<dependencies> | ||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="20037"/> | ||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> | ||
</dependencies> | ||
<objects> | ||
<customObject id="-2" userLabel="File's Owner" customClass="LoginPasswordWindowController" customModule="XCreds" customModuleProvider="target"> | ||
<connections> | ||
<outlet property="passwordTextField" destination="uxk-Kc-Ey2" id="NeY-1n-1d3"/> | ||
<outlet property="window" destination="y1s-aj-r0T" id="ZcP-JQ-mk1"/> | ||
</connections> | ||
</customObject> | ||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/> | ||
<customObject id="-3" userLabel="Application" customClass="NSObject"/> | ||
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" frameAutosaveName="" animationBehavior="default" titlebarAppearsTransparent="YES" titleVisibility="hidden" id="y1s-aj-r0T"> | ||
<windowStyleMask key="styleMask" titled="YES"/> | ||
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/> | ||
<rect key="contentRect" x="530" y="324" width="497" height="189"/> | ||
<rect key="screenRect" x="0.0" y="0.0" width="1536" height="935"/> | ||
<view key="contentView" id="keP-aO-VT7"> | ||
<rect key="frame" x="0.0" y="0.0" width="497" height="189"/> | ||
<autoresizingMask key="autoresizingMask"/> | ||
<subviews> | ||
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="GHv-Is-FVt"> | ||
<rect key="frame" x="20" y="121" width="68" height="68"/> | ||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> | ||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="NSApplicationIcon" id="i1e-r0-Waa"/> | ||
</imageView> | ||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="NQJ-DJ-Vk6"> | ||
<rect key="frame" x="94" y="118" width="385" height="64"/> | ||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> | ||
<textFieldCell key="cell" selectable="YES" id="Kf4-Rd-r7U"> | ||
<font key="font" metaFont="systemBold"/> | ||
<string key="title">Please enter your login password. XCreds saves the login password to the keychain to sync your login password and keychain password with your cloud password.</string> | ||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/> | ||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> | ||
</textFieldCell> | ||
</textField> | ||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="or1-FG-c7l"> | ||
<rect key="frame" x="96" y="108" width="215" height="14"/> | ||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> | ||
<textFieldCell key="cell" lineBreakMode="clipping" title="To allow this, enter your login password." id="NBo-xg-6iv"> | ||
<font key="font" metaFont="smallSystem"/> | ||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/> | ||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> | ||
</textFieldCell> | ||
</textField> | ||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Vgp-AS-5WP"> | ||
<rect key="frame" x="96" y="76" width="66" height="16"/> | ||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> | ||
<textFieldCell key="cell" lineBreakMode="clipping" title="Password:" id="gjN-RB-inR"> | ||
<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> | ||
<secureTextField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="uxk-Kc-Ey2"> | ||
<rect key="frame" x="168" y="73" width="309" height="21"/> | ||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> | ||
<secureTextFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" usesSingleLineMode="YES" id="C9u-SH-tmE"> | ||
<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> | ||
</secureTextField> | ||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="gTn-ws-NVT"> | ||
<rect key="frame" x="405" y="13" width="79" height="32"/> | ||
<buttonCell key="cell" type="push" title="Update" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="Koa-hU-IdG"> | ||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> | ||
<font key="font" metaFont="system"/> | ||
<string key="keyEquivalent" base64-UTF8="YES"> | ||
DQ | ||
</string> | ||
</buttonCell> | ||
<connections> | ||
<action selector="updateButtonPressed:" target="-2" id="0Yw-3m-Zc7"/> | ||
</connections> | ||
</button> | ||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="0Wv-NR-a6r"> | ||
<rect key="frame" x="330" y="13" width="76" height="32"/> | ||
<buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="yk2-3t-h59"> | ||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> | ||
<font key="font" metaFont="system"/> | ||
<string key="keyEquivalent" base64-UTF8="YES"> | ||
Gw | ||
</string> | ||
</buttonCell> | ||
<connections> | ||
<action selector="cancelButtonPressed:" target="-2" id="qAB-hi-1zy"/> | ||
</connections> | ||
</button> | ||
</subviews> | ||
<constraints> | ||
<constraint firstAttribute="bottom" secondItem="gTn-ws-NVT" secondAttribute="bottom" constant="20" symbolic="YES" id="1PF-dv-8LN"/> | ||
<constraint firstAttribute="trailing" secondItem="gTn-ws-NVT" secondAttribute="trailing" constant="20" symbolic="YES" id="Ca3-N3-wr2"/> | ||
<constraint firstItem="gTn-ws-NVT" firstAttribute="leading" secondItem="0Wv-NR-a6r" secondAttribute="trailing" constant="13" id="cuy-Mu-Sgh"/> | ||
<constraint firstItem="0Wv-NR-a6r" firstAttribute="centerY" secondItem="gTn-ws-NVT" secondAttribute="centerY" id="plG-CO-NAT"/> | ||
</constraints> | ||
</view> | ||
<connections> | ||
<outlet property="delegate" destination="-2" id="WxA-Qo-qaN"/> | ||
</connections> | ||
<point key="canvasLocation" x="122.5" y="341.5"/> | ||
</window> | ||
</objects> | ||
<resources> | ||
<image name="NSApplicationIcon" width="32" height="32"/> | ||
</resources> | ||
</document> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// | ||
// Window+Shake.swift | ||
// XCreds | ||
// | ||
// Created by Timothy Perfitt on 6/4/22. | ||
// | ||
|
||
import Foundation | ||
import Cocoa | ||
|
||
extension NSWindow { | ||
@objc func shake(_ sender: AnyObject?) { | ||
let numberOfShakes = 3 | ||
let durationOfShake = 0.4 | ||
let vigourOfShake : CGFloat = 0.03 | ||
let frame : CGRect = (self.frame) | ||
let shakeAnimation :CAKeyframeAnimation = CAKeyframeAnimation() | ||
|
||
let shakePath = CGMutablePath() | ||
shakePath.move( to: CGPoint(x:NSMinX(frame), y:NSMinY(frame))) | ||
|
||
for _ in 0...numberOfShakes-1 { | ||
shakePath.addLine(to: CGPoint(x:NSMinX(frame) - frame.size.width * vigourOfShake, y:NSMinY(frame))) | ||
shakePath.addLine(to: CGPoint(x:NSMinX(frame) + frame.size.width * vigourOfShake, y:NSMinY(frame))) | ||
} | ||
|
||
shakePath.closeSubpath() | ||
shakeAnimation.path = shakePath | ||
shakeAnimation.duration = durationOfShake | ||
|
||
let animations = [NSAnimatablePropertyKey( "frameOrigin") : shakeAnimation] | ||
|
||
self.animations = animations | ||
self.animator().setFrameOrigin(NSPoint(x: frame.minX, y: frame.minY)) | ||
} | ||
} |
Oops, something went wrong.