mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-04-22 03:17:56 +00:00
feat: hide Google sign-in in embedded WebView (DApps browser)
Google blocks OAuth in WebViews (disallowed_useragent policy). Detect WebView and hide the Google button, users in DApps browser use email/password instead. Google sign-in still works in real browsers (Chrome, Safari, etc).
This commit is contained in:
@@ -24,6 +24,11 @@ const Login: React.FC = () => {
|
||||
const [error, setError] = useState('');
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
// Detect embedded WebView (DApps browser) - hide Google OAuth there
|
||||
const isWebView = /wv|WebView/i.test(navigator.userAgent) ||
|
||||
(/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(navigator.userAgent)) ||
|
||||
(/Android.*Version\/[\d.]+.*Chrome\/[\d.]+ Mobile/i.test(navigator.userAgent) && !/Chrome\/[\d.]+ Mobile Safari/i.test(navigator.userAgent));
|
||||
|
||||
const [loginData, setLoginData] = useState({
|
||||
email: '',
|
||||
password: ''
|
||||
@@ -382,6 +387,7 @@ const Login: React.FC = () => {
|
||||
</div>
|
||||
|
||||
<div className="space-y-3">
|
||||
{!isWebView && (
|
||||
<Button
|
||||
variant="outline"
|
||||
className="w-full border-gray-700 bg-gray-800 hover:bg-gray-700 text-white"
|
||||
@@ -396,6 +402,7 @@ const Login: React.FC = () => {
|
||||
</svg>
|
||||
{t('login.googleSignIn', 'Continue with Google')}
|
||||
</Button>
|
||||
)}
|
||||
|
||||
<Button
|
||||
variant="outline"
|
||||
|
||||
Reference in New Issue
Block a user