in BiometricLoginKotlin/app/src/main/java/com/example/biometricloginsample/LoginWithPasswordViewModel.kt [55:70]
fun login(username: String, password: String) {
if (isUserNameValid(username) && isPasswordValid(password)) {
// Normally this method would asynchronously send this to your server and your sever
// would return a token. For high sensitivity apps such as banking, you would keep that
// token in transient memory similar to my SampleAppUser object. This way the user
// must login each time they start the app.
// In this sample, we don't call a server. Instead we use a fake token that we set
// right here:
SampleAppUser.username = username
SampleAppUser.fakeToken = java.util.UUID.randomUUID().toString()
_loginResult.value = LoginResult(true)
} else {
_loginResult.value = LoginResult(true)
}
}