Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if useKeychain {
- let server : String = "smb://cloud.amrhein.info"
- let user : String = "gerald"
- let pwd : String = "password"
- let keychain = Keychain(server: server, protocolType: .SMB)
- if let output : String = try! keychain.get(user) {
- print("Password (if): (output)")
- } else {
- print("start Ask4pwd")
- var pWindowController : NSWindowController?
- if let storyboard : NSStoryboard = NSStoryboard(name: "Main",bundle: nil) as NSStoryboard
- {
- if let vc = storyboard.instantiateControllerWithIdentifier("passwordViewController") as? passwordViewController
- {
- let myWindow = NSWindow(contentViewController: vc)
- myWindow.makeKeyAndOrderFront(self)
- pWindowController = NSWindowController(window: myWindow)
- pWindowController!.showWindow(self)
- }
- }
- do {
- try keychain
- .accessibility(.Always)
- .label("(server) ((user))")
- .comment("Use for Mount Volumes")
- .set(pwd, key: user)
- } catch let error {
- print(error)
- }
- }
- } else {
- password = passwordsArray[index!]
- }
- if password == "" {
- print("No password set - break!")
- break
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement