diff --git a/AuthApp/views.py b/AuthApp/views.py index a9bb308..4d5980a 100644 --- a/AuthApp/views.py +++ b/AuthApp/views.py @@ -288,7 +288,7 @@ def recovery_password_page_View(request, user_id, token): 'user': user } - t = loader.get_template('pages/profile/p_user_profile.html') + t = loader.get_template('pages/profile/p_password_recovery.html') response = get_inter_http_response(t, Dict, request) return response diff --git a/static/css/styles.css b/static/css/styles.css index 74408ca..f1a5a3b 100644 --- a/static/css/styles.css +++ b/static/css/styles.css @@ -1303,7 +1303,8 @@ section.login>form { color: rgba(39, 36, 36, 0.60); } .call_to_reg { - + cursor: pointer; + text-align: center; color: rgba(39, 36, 36, 0.60); font-style: normal; font-weight: 500; @@ -3365,6 +3366,16 @@ details[open] summary ~ *{ /*END news articles all*/ +.login_form.hide{ + display: none; +} +.password_recovery{ + display: none; +} +.password_recovery.show{ + display: block; +} + diff --git a/static/js/authorization.js b/static/js/authorization.js index e6cca7a..da0a6c3 100644 --- a/static/js/authorization.js +++ b/static/js/authorization.js @@ -3,14 +3,18 @@ function SendLoginForm(el){ event.preventDefault() let form = el.form; let formData = new FormData(form); - let msr = sessionStorage.getItem('mailingSubscribeRequired') - formData.set('mailingSubscribeRequired',msr) + let url = '/user_account/password_recovery/' + if(!el.classList.contains('recovery')){ + url = '/user_account/login/' + let msr = sessionStorage.getItem('mailingSubscribeRequired') + formData.set('mailingSubscribeRequired',msr) + } $.ajax({ headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() }, - url: '/user_account/login/', + url: url, type: "POST", // async: true, cache: false, diff --git a/static/js/registration.js b/static/js/registration.js index a747787..817fd19 100644 --- a/static/js/registration.js +++ b/static/js/registration.js @@ -1,13 +1,19 @@ -function SendRegistrationForm(el){ +function SendRegistrationForm(el, user_id){ event.preventDefault() let form = el.form; let formData = new FormData(form); - let msr = sessionStorage.getItem('mailingSubscribeRequired') - formData.set('mailingSubscribeRequired',msr) + let url = '/user_account/password_recovery_confirm/' + formData.set('user_id', user_id) + if(!el.classList.contains('recovery')){ + url = '/user_account/registration/'; + let msr = sessionStorage.getItem('mailingSubscribeRequired') + formData.set('mailingSubscribeRequired',msr) + } + $.ajax({ headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() }, - url: '/user_account/registration/', + url: url, type: "POST", // async: true, cache: false, @@ -16,6 +22,9 @@ function SendRegistrationForm(el){ // enctype: 'json', data: formData, success: function(data){ + + document.getElementById('confirm_password').innerHTML = data.message + document.querySelector('.info_text').classList.add('show') // location.href = `/profile/page/dashboard/` window.sessionStorage.removeItem('mailingSubscribeRequired') diff --git a/static/js/user_profile.js b/static/js/user_profile.js index 55e7154..02fcba0 100644 --- a/static/js/user_profile.js +++ b/static/js/user_profile.js @@ -1395,6 +1395,13 @@ function showTabBtn(el) { } +function showForm(){ + let hide_form = document.getElementsByClassName('login_form') + let show_form = document.getElementsByClassName('password_recovery') + hide_form[0].classList.add('hide') + show_form[0].classList.add('show') +} + diff --git a/templates/forms/f_login.html b/templates/forms/f_login.html index 8a861d6..f035b5f 100644 --- a/templates/forms/f_login.html +++ b/templates/forms/f_login.html @@ -49,6 +49,29 @@ {% endif %}