Skip to content

Commit 7f73ff8

Browse files
committed
fixing login with 2fa
1 parent e239c9e commit 7f73ff8

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

src/pages/LoginWith2fa.tsx

+7-7
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ export const LOGIN_WITH_2FA = gql`
4242
mutation LoginWithTwoFactorAuthentication(
4343
$email: String!
4444
$otp: String!
45-
$TwoWayVerificationToken: String!
45+
# $TwoWayVerificationToken: String!
4646
) {
4747
loginWithTwoFactorAuthentication(
4848
email: $email
4949
otp: $otp
50-
TwoWayVerificationToken: $TwoWayVerificationToken
50+
# TwoWayVerificationToken: $TwoWayVerificationToken
5151
) {
5252
token
5353
user {
@@ -84,7 +84,7 @@ const TwoFactorPage: React.FC = () => {
8484

8585
const location = useLocation();
8686
const navigate = useNavigate();
87-
const { email, TwoWayVerificationToken } = location.state || {};
87+
const { email } = location.state || {};
8888
useEffect(() => {
8989
// Update document class and localStorage when theme changes
9090
if (isDark) {
@@ -97,18 +97,18 @@ const TwoFactorPage: React.FC = () => {
9797
}, [isDark]);
9898

9999
useEffect(() => {
100-
if (!email || !TwoWayVerificationToken) {
100+
if (!email ) {
101101
navigate('/login');
102102
}
103-
}, [email, TwoWayVerificationToken, navigate]);
103+
}, [email, navigate]);
104104

105105
const [loginWithTwoFactorAuthentication] = useMutation<LoginResponse>(
106106
LOGIN_WITH_2FA,
107107
{
108108
onCompleted: async (data) => {
109109
const response = data.loginWithTwoFactorAuthentication;
110110
try {
111-
localStorage.setItem('authToken', response.token);
111+
//localStorage.setItem('authToken', response.token);
112112
localStorage.setItem('user', JSON.stringify(response.user));
113113
await login(response);
114114
await client.resetStore();
@@ -152,7 +152,7 @@ const TwoFactorPage: React.FC = () => {
152152
variables: {
153153
email,
154154
otp: currentInput.join(''),
155-
TwoWayVerificationToken,
155+
// TwoWayVerificationToken,
156156
},
157157
});
158158
} finally {

src/pages/Organization/AdminLogin.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ function AdminLogin() {
8080
onCompleted: async (data) => {
8181
if (data.loginUser.otpRequired) {
8282
setOtpRequired(true);
83-
setTwoWayVerificationToken(data.loginUser.TwoWayVerificationToken);
83+
// setTwoWayVerificationToken(data.loginUser.TwoWayVerificationToken);
8484
navigate('/users/LoginWith2fa', {
8585
state: {
8686
email: userInput.email,
87-
TwoWayVerificationToken: data.loginUser.TwoWayVerificationToken,
87+
// TwoWayVerificationToken: data.loginUser.TwoWayVerificationToken,
8888
},})
8989

9090
}else{

src/pages/Organization/LoginMutation.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const LOGIN_MUTATION = gql`
55
loginUser(loginInput: $loginInput) {
66
token
77
otpRequired
8-
TwoWayVerificationToken
8+
99
user {
1010
id
1111
role

0 commit comments

Comments
 (0)