D
D
dikyzz2019-11-07 11:34:46
JavaScript
dikyzz, 2019-11-07 11:34:46

In safari on ipad, you can see the entered passwords in the browsing history. How to fix?

When I authorize on my site, in the browsing history on safari in the url address, you can see the parameters of the completed form: login and password. What could be causing this?
5dc3d71d7ebd1698679717.png
In newer devices on the same safari there is no longer such a problem, on androids it is also normal.
ios 9.0.2
Code:
1. Form submission

function onSubmit(data: UserData) {
    setErrorMessage('');
    setError(false);

    if(!validatePhone(data.username)) {
      setPhoneError(true)
      return false;
    }
    else{
      data.username = data.country_code + data.username.replace(/[^0-9]/g, '');
      setPhoneError(false)
    }

    AuthService.login(data as UserData).then(async token => {
      await AuthService.auth(token);
      store.dispatch(addFeedNotifications([{type: 'success', title: 'Вход успешно выполнен!', text: ''}]))
      if (redirectBack) Router.back();
      else redirect('/');
    }).catch(() => {
      store.dispatch(addFeedNotifications([{type: 'error', title: 'Ошибка!', text: 'Неверно введен логин или пароль.'}]))
    });
  }

2. Login
static async login(data: GetTokenData) {
    const res = await post<GetTokenSuccess>('/api/login/', data);
    return res.data.token;
  }

3. Authorization and obtaining information about the user by token
static async auth(token?: string) {
    if (!Axios.defaults.headers.Authorization && !token) return;

    if (token) {
      setCookie('authtoken', token);
      Axios.defaults.headers.Authorization = `Token ${token}`;
      this.getUserData();
    }

    let currentUser = store.getState().user.currentUser;
    if(!currentUser) {
      store.dispatch(requestUser());
      return await get<User>('/api/socialnetwork/auth/').then(async res => {
        const user = res.data;
        store.dispatch(receiveUser(user));
        store.dispatch(receiveUsers([user]));

        await this.getUserData();
        return user;
      }).catch(_err => {});
    }
  }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2019-11-07
@NeiroNx

The GET method is used instead of POST, you need to pass it to the correct method.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question