Answer the question
In order to leave comments, you need to log in
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?
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: 'Неверно введен логин или пароль.'}]))
});
}
static async login(data: GetTokenData) {
const res = await post<GetTokenSuccess>('/api/login/', data);
return res.data.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
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question