self Register By Email
Facilitates user registration within the Rainbow environment, a two-step process:
First step: Initiate user registration by invoking this API method. Once used, an e-mail is sent to the provided email address.
Second step: To complete registration, use the selfRegisterUser method along with the SelfRegisterBody.Builder. Ensure using these essential properties:
SelfRegisterBody.Builder.loginEmail— The user's email address used for login.SelfRegisterBody.Builder.password— Desired password for the user account.SelfRegisterBody.Builder.temporaryToken— A 6-digit numeric code received via email.
Return
RainbowResult
Parameters
String The email address that will be used for user login.
String (optional) The language used to translate the email text. Should use the format defined by ISO 639-1. The device's local language is used if this parameter is not specified.
Samples
import com.ale.infra.rest.listeners.onFailure
import com.ale.infra.rest.listeners.onSuccess
import com.ale.infra.rest.user.SelfRegisterBody
import com.ale.rainbowsdk.RainbowSdk
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
fun main() {
//sampleStart
val email = "your_email@domain.com"
val password = "Password"
val code = "123456"
CoroutineScope(Dispatchers.Main).launch {
RainbowSdk().user().selfRegisterByEmail(email).onSuccess { data ->
val body = SelfRegisterBody.Builder()
.loginEmail(email)
.password(password)
.temporaryToken(code)
.firstName("FirstName")
.lastName("LastName")
.build()
RainbowSdk().user().selfRegisterUser(body).onSuccess {
// The user is registered and can now connect to the Rainbow environment.
}.onFailure {
// Error handling
}
}.onFailure {
// Error handling
}
}
//sampleEnd
}