LCUser

open class LCUser : LCObject

LeanCloud user type.

A base type of LeanCloud built-in user system. You can extend this class with custom properties. However, LCUser can be extended only once.

  • Username of user.

    Declaration

    Swift

    @objc
    dynamic public var username: LCString?
  • Password of user.

    Note

    this property will not be filled in when fetched or logged in for security.

    Declaration

    Swift

    @objc
    dynamic public var password: LCString?
  • Email of user.

    If the “Enable Email Verification” application option is enabled, a verification email will be sent to user when user registered with an email address.

    Declaration

    Swift

    @objc
    dynamic public var email: LCString?
  • A flag indicates whether email is verified or not.

    Declaration

    Swift

    @objc
    dynamic public private(set) var emailVerified: LCBool? { get }
  • Mobile phone number.

    If the “Enable Mobile Phone Number Verification” application option is enabled, an sms message will be sent to user’s phone when user registered with a phone number.

    Declaration

    Swift

    @objc
    dynamic public var mobilePhoneNumber: LCString?
  • A flag indicates whether mobile phone is verified or not.

    Declaration

    Swift

    @objc
    dynamic public private(set) var mobilePhoneVerified: LCBool? { get }
  • Auth Data of third party account.

    Declaration

    Swift

    @objc
    dynamic public private(set) var authData: LCDictionary? { get }
  • Session token of user authenticated by server.

    Declaration

    Swift

    @objc
    dynamic public private(set) var sessionToken: LCString? { get }
  • Declaration

    Swift

    public final override class func objectClassName() -> String

Sign up

Log in with username and password

Log in with email and password

Log in with phone number and password

Log in with phone number and verification code

Log in with session token

Sign up or log in with phone number and verification code

Send verification mail

Send verification code

Verify phone number

Send a login verification code

Send password reset mail

Send password reset short message

Reset password with verification code and new password

  • Reset password with verification code and new password synchronously. This method will reset password of current user. If current user is nil, in other words, no user logged in, Password reset will be failed because of permission.

    Declaration

    Swift

    public static func resetPassword(application: LCApplication = .default, mobilePhoneNumber: String, verificationCode: String, newPassword: String) -> LCBooleanResult

    Parameters

    application

    The application current user belong to, default is LCApplication.default.

    mobilePhoneNumber

    The mobile phone number of current user.

    verificationCode

    The verification code in password reset message.

    newPassword

    The new password of current user.

  • Reset password with verification code and new password asynchronously. This method will reset password of current user. If current user is nil, in other words, no user logged in, Password reset will be failed because of permission.

    Declaration

    Swift

    @discardableResult
    public static func resetPassword(
        application: LCApplication = .default,
        mobilePhoneNumber: String,
        verificationCode: String,
        newPassword: String,
        completionQueue: DispatchQueue = .main,
        completion: @escaping (LCBooleanResult) -> Void)
        -> LCRequest

    Parameters

    application

    The application current user belong to, default is LCApplication.default.

    mobilePhoneNumber

    The mobile phone number of current user.

    verificationCode

    The verification code in password reset message.

    newPassword

    The new password of current user.

    completionQueue

    The queue where completion be executed, default is main.

    completion

    Result callback.

Update password with new password

Auth Data