@ -23,7 +23,6 @@ class LoginQRViewModel : IpnViewModel() {
val numCode : StateFlow < String ? > = MutableStateFlow ( null )
val numCode : StateFlow < String ? > = MutableStateFlow ( null )
val qrCode : StateFlow < ImageBitmap ? > = MutableStateFlow ( null )
val qrCode : StateFlow < ImageBitmap ? > = MutableStateFlow ( null )
// Remove this once changes to admin console allowing input code to be entered are made.
// Remove this once changes to admin console allowing input code to be entered are made.
val codeEnabled = false
init {
init {
viewModelScope . launch {
viewModelScope . launch {
@ -31,17 +30,15 @@ class LoginQRViewModel : IpnViewModel() {
url ?. let {
url ?. let {
qrCode . set ( generateQRCode ( url , 200 , 0 ) )
qrCode . set ( generateQRCode ( url , 200 , 0 ) )
if ( codeEnabled ) {
// Extract the string after "https://login.tailscale.com/a/"
// Extract the string after "https://login.tailscale.com/a/"
val prefix = " https://login.tailscale.com/a/ "
val prefix = " https://login.tailscale.com/a/ "
val code =
val code =
if ( it . startsWith ( prefix ) ) {
if ( it . startsWith ( prefix ) ) {
it . removePrefix ( prefix )
it . removePrefix ( prefix )
} else {
} else {
null
null
}
}
numCode . set ( code )
numCode . set ( code )
}
}
}
?: run {
?: run {
qrCode . set ( null )
qrCode . set ( null )