mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-15 06:40:30 +05:30
Use Patterns.EMAIL_ADDRESS regex.
This commit is contained in:
parent
a4e2496f58
commit
bce6648a0a
@ -3,6 +3,7 @@ package com.github.libretube.ui.dialogs
|
|||||||
import android.app.Dialog
|
import android.app.Dialog
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
|
import android.util.Patterns
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.fragment.app.DialogFragment
|
import androidx.fragment.app.DialogFragment
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
@ -14,7 +15,6 @@ import com.github.libretube.api.obj.Token
|
|||||||
import com.github.libretube.databinding.DialogLoginBinding
|
import com.github.libretube.databinding.DialogLoginBinding
|
||||||
import com.github.libretube.extensions.TAG
|
import com.github.libretube.extensions.TAG
|
||||||
import com.github.libretube.helpers.PreferenceHelper
|
import com.github.libretube.helpers.PreferenceHelper
|
||||||
import com.github.libretube.util.TextUtils
|
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
import kotlinx.serialization.decodeFromString
|
import kotlinx.serialization.decodeFromString
|
||||||
import retrofit2.HttpException
|
import retrofit2.HttpException
|
||||||
@ -113,6 +113,6 @@ class LoginDialog(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun isEmail(text: String): Boolean {
|
private fun isEmail(text: String): Boolean {
|
||||||
return TextUtils.EMAIL_REGEX.toRegex().matches(text)
|
return Patterns.EMAIL_ADDRESS.toRegex().matches(text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,11 +14,6 @@ object TextUtils {
|
|||||||
*/
|
*/
|
||||||
const val SEPARATOR = " • "
|
const val SEPARATOR = " • "
|
||||||
|
|
||||||
/**
|
|
||||||
* Regex to check for e-mails
|
|
||||||
*/
|
|
||||||
const val EMAIL_REGEX = "^[A-Za-z](.*)([@]{1})(.{1,})(\\.)(.{1,})"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reserved characters by unix which can not be used for file name.
|
* Reserved characters by unix which can not be used for file name.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user