Commit 9a1ed3fb authored by Joel Rennich's avatar Joel Rennich

site lookup regression fix, window focus cleanup

parent 4cb3714b
......@@ -329,16 +329,21 @@ class LDAPServers : NSObject, DNSResolverDelegate {
// loop through all of the possible networks until we get a match, or fall through
while subMask >= 0 && !found && subnetCount >= 2 {
var networkBit = 0
let octet = subMask / 8
let octetMask = subMask % 8
let network = Int(IPOctets[octet])! - (Int(IPOctets[octet])! % binToDecimal(octetMask))
if octetMask == 4 {
networkBit = Int(IPOctets[3])!
} else {
networkBit = Int(IPOctets[octet])! - (Int(IPOctets[octet])! % binToDecimal(octetMask))
}
switch octet {
case 0 : IP = String(network) + ".0.0.0"
case 1 : IP = IPOctets[0] + "." + String(network) + ".0.0"
case 2 : IP = IPOctets[0] + "." + IPOctets[1] + "." + String(network) + ".0"
case 3 : IP = IPOctets[0] + "." + IPOctets[1] + "." + IPOctets[2] + "." + String(network)
case 0 : IP = String(networkBit) + ".0.0.0"
case 1 : IP = IPOctets[0] + "." + String(networkBit) + ".0.0"
case 2 : IP = IPOctets[0] + "." + IPOctets[1] + "." + String(networkBit) + ".0"
case 3 : IP = IPOctets[0] + "." + IPOctets[1] + "." + IPOctets[2] + "." + String(networkBit)
case 4 : IP = IPOctets[0] + "." + IPOctets[1] + "." + IPOctets[2] + "." + IPOctets[3]
default : IP = IPOctets[0] + "." + IPOctets[1] + "." + IPOctets[2] + "." + IPOctets[3]
}
......
......@@ -38,8 +38,6 @@ class LoginWindow: NSWindowController, NSWindowDelegate {
super.windowDidLoad()
guard (( defaults.stringForKey("LastUser") ) != nil) else {
self.window?.center()
NSApp.activateIgnoringOtherApps(true)
self.window?.makeKeyAndOrderFront(nil)
setWindowToLogin()
return
}
......@@ -50,8 +48,7 @@ class LoginWindow: NSWindowController, NSWindowDelegate {
setWindowToLogin()
self.window?.center()
NSApp.activateIgnoringOtherApps(true)
self.window?.makeKeyAndOrderFront(nil)
}
func windowWillClose(notification: NSNotification) {
......@@ -61,7 +58,6 @@ class LoginWindow: NSWindowController, NSWindowDelegate {
notificationCenter.postNotification(notificationKey)
delegate?.updateUserInfo()
}
@IBAction func LogInClick(sender: AnyObject) {
......
......@@ -52,7 +52,9 @@ let settings = [
"ExpeditedLookup" : 0,
"UserPasswordSetDates" : NSDictionary()
]
// Add method that forces Window to Front
extension NSWindow {
func forceToFrontAndFocus(sender: AnyObject?) {
NSApp.activateIgnoringOtherApps(true)
......
......@@ -28,8 +28,6 @@ class PasswordChangeWindow: NSWindowController, NSWindowDelegate {
super.windowDidLoad()
self.window?.center()
self.window?.makeKeyAndOrderFront(nil)
NSApp.activateIgnoringOtherApps(true)
// blank out the password fields
oldPassword.stringValue = ""
......@@ -39,6 +37,7 @@ class PasswordChangeWindow: NSWindowController, NSWindowDelegate {
}
func windowWillClose(notification: NSNotification) {
// blank out the password fields
oldPassword.stringValue = ""
newPassword.stringValue = ""
......@@ -216,9 +215,6 @@ class PasswordChangeWindow: NSWindowController, NSWindowDelegate {
private func checkKpasswdServer(writePref: Bool ) -> Bool {
//let myKpasswdServers = delegate?.userInformation.myLDAPServers.getSRVRecords(domain: defaults.stringForKey("ADDomain")!, srv_type: "_kdc._tcp")
//let myKpasswdServers = getSRVRecords(defaults.stringForKey("ADDomain")!, srv_type: "_kpasswd._tcp.")
let myLDAPServers = LDAPServers()
myLDAPServers.setDomain(defaults.stringForKey("ADDomain")!)
let myKpasswdServers = myLDAPServers.getSRVRecords(defaults.stringForKey("ADDomain")!, srv_type: "_kpasswd._tcp.")
......
......@@ -41,8 +41,6 @@ class PreferencesWindow: NSWindowController, NSWindowDelegate {
super.windowDidLoad()
self.window?.center()
self.window?.makeKeyAndOrderFront(nil)
NSApp.activateIgnoringOtherApps(true)
// set the fields and disable them if they're managed
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment