                             self.performSegueWithIdentifier("showGroups", sender: nil)
                         }
                     })
+                    self.saveNewUser(nameTextField.text!, email: loginTextField.text!)
                 }
             }
             

        let alertController = UIAlertController(title: "Create account", message: "You can create new account", preferredStyle: .Alert)
        
        let loginAction = UIAlertAction(title: "Create", style: .Default) { (_) in
            let loginTextField = alertController.textFields![0] as UITextField
            let passwordTextField = alertController.textFields![1] as UITextField
            
            self.firebase.createUser(loginTextField.text, password: passwordTextField.text) { (error: NSError!) in
                

        }*/
    }
    
    func saveNewUser(name:String, email:String){
        let usersRef = Firebase(url: "https://glowing-heat-6814.firebaseio.com/users/")
        let myID = usersRef.authData.uid
        let jsonUser = ["name":"\(name)", "email":"\(email)"]
        let newUser = usersRef.childByAppendingPath("\(myID)")
        newUser.setValue(jsonUser)
    }
    
}
