# User Management

At the core of many apps, there is a notion of user account management that lets users access their information in a secure manner. A specialized user class called `ParseUser` is available to automatically handles these kind of functionalities.

`ParseUser` is a subclass of the `ParseObject`, and has all the same features. All the methods that are on `ParseObject` also exist in `ParseUser`. The difference is that `ParseUser` has some special additions specific to user accounts.

## Signing Up&#x20;

{% tabs %}
{% tab title="Java" %}

```java
import com.parse.ParseException;
import com.parse.ParseUser;
import com.parse.SignUpCallback;

public void signUpUser(String username, String password, String email)
{
    ParseUser user = new ParseUser();
    
    user.setUsername(username);
    user.setPassword(password);
    user.setEmail(email);
    
    // other fields can be set just like with ParseObject
    user.put("phone", "650-253-0000");

    user.signUpInBackground(new SignUpCallback() 
    {
      public void done(ParseException e) 
      {
        if (e == null) 
        {
          // Hooray! Let them use the app now.
        } 
        else
        {
          // Sign up didn't succeed. Look at the ParseException
          // to figure out what went wrong
        }
      }
  });
  
}
```

{% endtab %}

{% tab title="Swift" %}

```swift
import Parse
​
class testVC: UIViewController
{
    func SignUpUser(email:String, pwd:String)
    {
        let user = PFUser.init()
        user.username = "demo@symbyoz.io"
        user.email = "demo@symbyoz.io"
        user.password = "demo"
        
        user.signUpInBackground
        {
            (isConnect, error) in
            
            if let error = error
            {
                print (error.localizedDescription)
            }
            else
            {
                if isConnect
                {
                    print ("user connect")
                }
            }  
        }
    }
}

```

{% endtab %}
{% endtabs %}

## Logging In

{% tabs %}
{% tab title="Java" %}

```java
import com.parse.LogInCallback;
import com.parse.ParseException;
import com.parse.ParseUser;

public void logInUser(String username, String password)
{
    ParseUser.logInInBackground(username, password, new LogInCallback() 
    {
      public void done(ParseUser user, ParseException e)
      {
        if (user != null) 
        {
            // Hooray! The user is logged in.
        } 
        else 
        {
            // Signup failed. Look at the ParseException to see what happened.
        }
      }
    });
}
```

{% endtab %}

{% tab title="Swift" %}

```swift
import Parse
​
class testVC: UIViewController
{
    ​
   func connectUser(email: String, password: String, completion:@escaping (_ isSuccess: Bool, _ error: String) -> Void)
    {
        PFUser.logInWithUsername (inBackground:email, password: password, block:
        {
            (User, error) -> Void in
                
            if ((error) != nil)
            {
                completion(false, error!.localizedDescription)
            }
            else
            {
                if let user = User
                {
                    print ("user = ", user.description)
                    completion(true, "User connected")
                }
                else
                {
                    completion(false, "User is empty")
                }
            }
        })
    }

}
```

{% endtab %}
{% endtabs %}

## Get current User

{% tabs %}
{% tab title="Java" %}

```java
import com.parse.ParseUser;

public void getUser()
{
    ParseUser currentUser = ParseUser.getCurrentUser();
    
    if (currentUser != null) 
    {
        // do stuff with the user
    } 
    else 
    {
        // show the signup or login screen
    }
}
```

{% endtab %}

{% tab title="Swift" %}

```swift
import Parse

class testVC: UIViewController
{
    func getUser ()
    {
        let currentUser = PFUser.currentUser
    
        if currentUser != nil 
        {
            if currentUser!.isNew 
            {
                print ("is new user")
            }
        }
    }
}



```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.symbyoz.io/code_examples/user-management.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
