Felix Zieger
commited on
Commit
·
dc83eea
1
Parent(s):
018dc4e
update
Browse files- src/pages/auth/Login.tsx +16 -2
- src/pages/auth/Register.tsx +16 -2
src/pages/auth/Login.tsx
CHANGED
|
@@ -40,6 +40,7 @@ export const Login = () => {
|
|
| 40 |
const [isOAuthLoading, setIsOAuthLoading] = useState(false);
|
| 41 |
const { toast } = useToast();
|
| 42 |
const t = useTranslation();
|
|
|
|
| 43 |
|
| 44 |
const form = useForm<z.infer<typeof formSchema>>({
|
| 45 |
resolver: zodResolver(formSchema),
|
|
@@ -183,7 +184,7 @@ export const Login = () => {
|
|
| 183 |
onClick={() => {
|
| 184 |
window.google?.accounts.id.prompt();
|
| 185 |
}}
|
| 186 |
-
disabled={isLoading}
|
| 187 |
>
|
| 188 |
<img src="https://www.google.com/favicon.ico" alt="Google" className="w-4 h-4" />
|
| 189 |
Continue with Google
|
|
@@ -194,13 +195,26 @@ export const Login = () => {
|
|
| 194 |
variant="outline"
|
| 195 |
className="w-full flex items-center justify-center gap-2"
|
| 196 |
onClick={handleGitHubLogin}
|
| 197 |
-
disabled={isLoading}
|
| 198 |
>
|
| 199 |
<svg className="w-4 h-4" viewBox="0 0 24 24" fill="currentColor">
|
| 200 |
<path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z" />
|
| 201 |
</svg>
|
| 202 |
Continue with GitHub
|
| 203 |
</Button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 204 |
</div>
|
| 205 |
|
| 206 |
<div className="relative">
|
|
|
|
| 40 |
const [isOAuthLoading, setIsOAuthLoading] = useState(false);
|
| 41 |
const { toast } = useToast();
|
| 42 |
const t = useTranslation();
|
| 43 |
+
const isEmbedded = !!import.meta.env.VITE_HUGGINGFACE;
|
| 44 |
|
| 45 |
const form = useForm<z.infer<typeof formSchema>>({
|
| 46 |
resolver: zodResolver(formSchema),
|
|
|
|
| 184 |
onClick={() => {
|
| 185 |
window.google?.accounts.id.prompt();
|
| 186 |
}}
|
| 187 |
+
disabled={isLoading || isEmbedded}
|
| 188 |
>
|
| 189 |
<img src="https://www.google.com/favicon.ico" alt="Google" className="w-4 h-4" />
|
| 190 |
Continue with Google
|
|
|
|
| 195 |
variant="outline"
|
| 196 |
className="w-full flex items-center justify-center gap-2"
|
| 197 |
onClick={handleGitHubLogin}
|
| 198 |
+
disabled={isLoading || isEmbedded}
|
| 199 |
>
|
| 200 |
<svg className="w-4 h-4" viewBox="0 0 24 24" fill="currentColor">
|
| 201 |
<path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z" />
|
| 202 |
</svg>
|
| 203 |
Continue with GitHub
|
| 204 |
</Button>
|
| 205 |
+
{isEmbedded && (
|
| 206 |
+
<p className="text-sm text-muted-foreground text-center">
|
| 207 |
+
Social logins are only available on{" "}
|
| 208 |
+
<a
|
| 209 |
+
href="https://think-in-sync.com"
|
| 210 |
+
target="_blank"
|
| 211 |
+
rel="noopener noreferrer"
|
| 212 |
+
className="text-primary hover:underline"
|
| 213 |
+
>
|
| 214 |
+
think-in-sync.com
|
| 215 |
+
</a>
|
| 216 |
+
</p>
|
| 217 |
+
)}
|
| 218 |
</div>
|
| 219 |
|
| 220 |
<div className="relative">
|
src/pages/auth/Register.tsx
CHANGED
|
@@ -44,6 +44,7 @@ export const Register = () => {
|
|
| 44 |
const [isOAuthLoading, setIsOAuthLoading] = useState(false);
|
| 45 |
const { toast } = useToast();
|
| 46 |
const t = useTranslation();
|
|
|
|
| 47 |
|
| 48 |
const form = useForm<z.infer<typeof formSchema>>({
|
| 49 |
resolver: zodResolver(formSchema),
|
|
@@ -190,7 +191,7 @@ export const Register = () => {
|
|
| 190 |
onClick={() => {
|
| 191 |
window.google?.accounts.id.prompt();
|
| 192 |
}}
|
| 193 |
-
disabled={isLoading}
|
| 194 |
>
|
| 195 |
<img src="https://www.google.com/favicon.ico" alt="Google" className="w-4 h-4" />
|
| 196 |
Continue with Google
|
|
@@ -201,13 +202,26 @@ export const Register = () => {
|
|
| 201 |
variant="outline"
|
| 202 |
className="w-full flex items-center justify-center gap-2"
|
| 203 |
onClick={handleGitHubLogin}
|
| 204 |
-
disabled={isLoading}
|
| 205 |
>
|
| 206 |
<svg className="w-4 h-4" viewBox="0 0 24 24" fill="currentColor">
|
| 207 |
<path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z" />
|
| 208 |
</svg>
|
| 209 |
Continue with GitHub
|
| 210 |
</Button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 211 |
</div>
|
| 212 |
|
| 213 |
<div className="relative">
|
|
|
|
| 44 |
const [isOAuthLoading, setIsOAuthLoading] = useState(false);
|
| 45 |
const { toast } = useToast();
|
| 46 |
const t = useTranslation();
|
| 47 |
+
const isEmbedded = !!import.meta.env.VITE_HUGGINGFACE;
|
| 48 |
|
| 49 |
const form = useForm<z.infer<typeof formSchema>>({
|
| 50 |
resolver: zodResolver(formSchema),
|
|
|
|
| 191 |
onClick={() => {
|
| 192 |
window.google?.accounts.id.prompt();
|
| 193 |
}}
|
| 194 |
+
disabled={isLoading || isEmbedded}
|
| 195 |
>
|
| 196 |
<img src="https://www.google.com/favicon.ico" alt="Google" className="w-4 h-4" />
|
| 197 |
Continue with Google
|
|
|
|
| 202 |
variant="outline"
|
| 203 |
className="w-full flex items-center justify-center gap-2"
|
| 204 |
onClick={handleGitHubLogin}
|
| 205 |
+
disabled={isLoading || isEmbedded}
|
| 206 |
>
|
| 207 |
<svg className="w-4 h-4" viewBox="0 0 24 24" fill="currentColor">
|
| 208 |
<path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z" />
|
| 209 |
</svg>
|
| 210 |
Continue with GitHub
|
| 211 |
</Button>
|
| 212 |
+
{isEmbedded && (
|
| 213 |
+
<p className="text-sm text-muted-foreground text-center">
|
| 214 |
+
Social logins are only available on{" "}
|
| 215 |
+
<a
|
| 216 |
+
href="https://think-in-sync.com"
|
| 217 |
+
target="_blank"
|
| 218 |
+
rel="noopener noreferrer"
|
| 219 |
+
className="text-primary hover:underline"
|
| 220 |
+
>
|
| 221 |
+
think-in-sync.com
|
| 222 |
+
</a>
|
| 223 |
+
</p>
|
| 224 |
+
)}
|
| 225 |
</div>
|
| 226 |
|
| 227 |
<div className="relative">
|