mirror of
https://github.com/vector-im/element-call.git
synced 2024-11-15 00:04:59 +08:00
Dont send register request in widget mode (#2100)
* dont register in widget mode Signed-off-by: Timo K <toger5@hotmail.de> * not call registerPasswordlessUser where its called in a widget. Signed-off-by: Timo K <toger5@hotmail.de> --------- Signed-off-by: Timo K <toger5@hotmail.de>
This commit is contained in:
parent
87df439020
commit
6539c15177
@ -21,6 +21,7 @@ import { useClient } from "../ClientContext";
|
|||||||
import { useInteractiveRegistration } from "../auth/useInteractiveRegistration";
|
import { useInteractiveRegistration } from "../auth/useInteractiveRegistration";
|
||||||
import { generateRandomName } from "../auth/generateRandomName";
|
import { generateRandomName } from "../auth/generateRandomName";
|
||||||
import { useRecaptcha } from "../auth/useRecaptcha";
|
import { useRecaptcha } from "../auth/useRecaptcha";
|
||||||
|
import { widget } from "../widget";
|
||||||
|
|
||||||
interface UseRegisterPasswordlessUserType {
|
interface UseRegisterPasswordlessUserType {
|
||||||
privacyPolicyUrl?: string;
|
privacyPolicyUrl?: string;
|
||||||
@ -39,6 +40,11 @@ export function useRegisterPasswordlessUser(): UseRegisterPasswordlessUserType {
|
|||||||
if (!setClient) {
|
if (!setClient) {
|
||||||
throw new Error("No client context");
|
throw new Error("No client context");
|
||||||
}
|
}
|
||||||
|
if (widget) {
|
||||||
|
throw new Error(
|
||||||
|
"Registration was skipped: We should never try to register password-less user in embedded mode.",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const recaptchaResponse = await execute();
|
const recaptchaResponse = await execute();
|
||||||
|
@ -29,6 +29,7 @@ import { useOptInAnalytics } from "../settings/useSetting";
|
|||||||
import { HomePage } from "../home/HomePage";
|
import { HomePage } from "../home/HomePage";
|
||||||
import { platform } from "../Platform";
|
import { platform } from "../Platform";
|
||||||
import { AppSelectionModal } from "./AppSelectionModal";
|
import { AppSelectionModal } from "./AppSelectionModal";
|
||||||
|
import { widget } from "../widget";
|
||||||
|
|
||||||
export const RoomPage: FC = () => {
|
export const RoomPage: FC = () => {
|
||||||
const {
|
const {
|
||||||
@ -62,7 +63,7 @@ export const RoomPage: FC = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// If we've finished loading, are not already authed and we've been given a display name as
|
// If we've finished loading, are not already authed and we've been given a display name as
|
||||||
// a URL param, automatically register a passwordless user
|
// a URL param, automatically register a passwordless user
|
||||||
if (!loading && !authenticated && displayName) {
|
if (!loading && !authenticated && displayName && !widget) {
|
||||||
setIsRegistering(true);
|
setIsRegistering(true);
|
||||||
registerPasswordlessUser(displayName).finally(() => {
|
registerPasswordlessUser(displayName).finally(() => {
|
||||||
setIsRegistering(false);
|
setIsRegistering(false);
|
||||||
|
Loading…
Reference in New Issue
Block a user