Package io.realm.mongodb.auth
Class EmailPasswordAuth
- java.lang.Object
-
- io.realm.mongodb.auth.EmailPasswordAuth
-
public abstract class EmailPasswordAuth extends Object
Class encapsulating functionality provided whenUser
's are logged in through theCredentials.Provider.EMAIL_PASSWORD
provider.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
callResetPasswordFunction(String email, String newPassword, Object... args)
Call the reset password function configured to theCredentials.Provider.EMAIL_PASSWORD
provider.RealmAsyncTask
callResetPasswordFunctionAsync(String email, String newPassword, Object[] args, App.Callback<Void> callback)
Call the reset password function configured to theCredentials.Provider.EMAIL_PASSWORD
provider.void
confirmUser(String token, String tokenId)
Confirms a user with the given token and token id.RealmAsyncTask
confirmUserAsync(String token, String tokenId, App.Callback<Void> callback)
Confirms a user with the given token and token id.void
registerUser(String email, String password)
Registers a new user with the given email and password.RealmAsyncTask
registerUserAsync(String email, String password, App.Callback<Void> callback)
Registers a new user with the given email and password.void
resendConfirmationEmail(String email)
Resend the confirmation for a user to the given email.RealmAsyncTask
resendConfirmationEmailAsync(String email, App.Callback<Void> callback)
Resend the confirmation for a user to the given email.void
resetPassword(String token, String tokenId, String newPassword)
Resets the password of a user with the given token, token id, and new password.RealmAsyncTask
resetPasswordAsync(String token, String tokenId, String newPassword, App.Callback<Void> callback)
Resets the newPassword of a user with the given token, token id, and new password.void
retryCustomConfirmation(String email)
Retries the custom confirmation on a user for a given email.RealmAsyncTask
retryCustomConfirmationAsync(String email, App.Callback<Void> callback)
Retries the custom confirmation on a user for a given email.void
sendResetPasswordEmail(String email)
Sends a user a password reset email for the given email.RealmAsyncTask
sendResetPasswordEmailAsync(String email, App.Callback<Void> callback)
Sends a user a password reset email for the given email.
-
-
-
Method Detail
-
registerUser
public void registerUser(String email, String password) throws AppException
Registers a new user with the given email and password.- Parameters:
email
- the email to register with. This will be the username used during log in.password
- the password to associate with the email. The password must be between 6 and 128 characters long.- Throws:
AppException
- if the server failed to register the user.
-
registerUserAsync
public RealmAsyncTask registerUserAsync(String email, String password, App.Callback<Void> callback)
Registers a new user with the given email and password.- Parameters:
email
- the email to register with. This will be the username used during log in.password
- the password to associated with the email. The password must be between 6 and 128 characters long.callback
- callback when registration has completed or failed. The callback will always happen on the same thread as this method is called on.- Throws:
IllegalStateException
- if called from a non-looper thread.AppException
- if the server failed to register the user.
-
confirmUser
public void confirmUser(String token, String tokenId) throws AppException
Confirms a user with the given token and token id.- Parameters:
token
- the confirmation token.tokenId
- the id of the confirmation token.- Throws:
AppException
- if the server failed to confirm the user.
-
confirmUserAsync
public RealmAsyncTask confirmUserAsync(String token, String tokenId, App.Callback<Void> callback)
Confirms a user with the given token and token id.- Parameters:
token
- the confirmation token.tokenId
- the id of the confirmation token.callback
- callback when confirmation has completed or failed. The callback will always happen on the same thread as this method is called on.- Throws:
IllegalStateException
- if called from a non-looper thread.
-
resendConfirmationEmail
public void resendConfirmationEmail(String email) throws AppException
Resend the confirmation for a user to the given email.- Parameters:
email
- the email of the user.- Throws:
AppException
- if the server failed to confirm the user.
-
resendConfirmationEmailAsync
public RealmAsyncTask resendConfirmationEmailAsync(String email, App.Callback<Void> callback)
Resend the confirmation for a user to the given email.- Parameters:
email
- the email of the user.callback
- callback when resending the email has completed or failed. The callback will always happen on the same thread as this method is called on.- Throws:
IllegalStateException
- if called from a non-looper thread.
-
retryCustomConfirmation
public void retryCustomConfirmation(String email) throws AppException
Retries the custom confirmation on a user for a given email.- Parameters:
email
- the email of the user.- Throws:
AppException
- if the server failed to confirm the user.
-
retryCustomConfirmationAsync
public RealmAsyncTask retryCustomConfirmationAsync(String email, App.Callback<Void> callback)
Retries the custom confirmation on a user for a given email.- Parameters:
email
- the email of the user.callback
- callback when retrying the custom confirmation has completed or failed. The callback will always happen on the same thread as this method is called on.- Throws:
IllegalStateException
- if called from a non-looper thread.
-
sendResetPasswordEmail
public void sendResetPasswordEmail(String email) throws AppException
Sends a user a password reset email for the given email.- Parameters:
email
- the email of the user.- Throws:
AppException
- if the server failed to confirm the user.
-
sendResetPasswordEmailAsync
public RealmAsyncTask sendResetPasswordEmailAsync(String email, App.Callback<Void> callback)
Sends a user a password reset email for the given email.- Parameters:
email
- the email of the user.callback
- callback when sending the email has completed or failed. The callback will always happen on the same thread as this method is called on.- Throws:
AppException
- if the server failed to confirm the user.
-
callResetPasswordFunction
public void callResetPasswordFunction(String email, String newPassword, Object... args) throws AppException
Call the reset password function configured to theCredentials.Provider.EMAIL_PASSWORD
provider.- Parameters:
email
- the email of the user.newPassword
- the new password of the user.args
- any additional arguments provided to the reset function. All arguments must be able to be converted to JSON compatible values usingtoString()
.- Throws:
AppException
- if the server failed to confirm the user.
-
callResetPasswordFunctionAsync
public RealmAsyncTask callResetPasswordFunctionAsync(String email, String newPassword, Object[] args, App.Callback<Void> callback)
Call the reset password function configured to theCredentials.Provider.EMAIL_PASSWORD
provider.- Parameters:
email
- the email of the user.newPassword
- the new password of the user.args
- any additional arguments provided to the reset function. All arguments must be able to be converted to JSON compatible values usingtoString()
.callback
- callback when the reset has completed or failed. The callback will always happen on the same thread as this this method is called on.- Throws:
IllegalStateException
- if called from a non-looper thread.
-
resetPassword
public void resetPassword(String token, String tokenId, String newPassword) throws AppException
Resets the password of a user with the given token, token id, and new password.- Parameters:
token
- the reset password token.tokenId
- the id of the reset password token.newPassword
- the new password for the user identified by thetoken
. The password must be between 6 and 128 characters long.- Throws:
AppException
- if the server failed to confirm the user.
-
resetPasswordAsync
public RealmAsyncTask resetPasswordAsync(String token, String tokenId, String newPassword, App.Callback<Void> callback)
Resets the newPassword of a user with the given token, token id, and new password.- Parameters:
token
- the reset password token.tokenId
- the id of the reset password token.newPassword
- the new password for the user identified by thetoken
. The password must be between 6 and 128 characters long.callback
- callback when the reset has completed or failed. The callback will always happen on the same thread as this this method is called on.- Throws:
IllegalStateException
- if called from a non-looper thread.
-
-