1.2.6 password recovery TRI-108
This commit is contained in:
@@ -288,7 +288,7 @@ def recovery_password_page_View(request, user_id, token):
|
|||||||
'user': user
|
'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)
|
response = get_inter_http_response(t, Dict, request)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|||||||
@@ -1303,7 +1303,8 @@ section.login>form {
|
|||||||
color: rgba(39, 36, 36, 0.60);
|
color: rgba(39, 36, 36, 0.60);
|
||||||
}
|
}
|
||||||
.call_to_reg {
|
.call_to_reg {
|
||||||
|
cursor: pointer;
|
||||||
|
text-align: center;
|
||||||
color: rgba(39, 36, 36, 0.60);
|
color: rgba(39, 36, 36, 0.60);
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
@@ -3365,6 +3366,16 @@ details[open] summary ~ *{
|
|||||||
|
|
||||||
/*END news articles all*/
|
/*END news articles all*/
|
||||||
|
|
||||||
|
.login_form.hide{
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.password_recovery{
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.password_recovery.show{
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,14 +3,18 @@ function SendLoginForm(el){
|
|||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
let form = el.form;
|
let form = el.form;
|
||||||
let formData = new FormData(form);
|
let formData = new FormData(form);
|
||||||
let msr = sessionStorage.getItem('mailingSubscribeRequired')
|
let url = '/user_account/password_recovery/'
|
||||||
formData.set('mailingSubscribeRequired',msr)
|
if(!el.classList.contains('recovery')){
|
||||||
|
url = '/user_account/login/'
|
||||||
|
let msr = sessionStorage.getItem('mailingSubscribeRequired')
|
||||||
|
formData.set('mailingSubscribeRequired',msr)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
|
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
|
||||||
url: '/user_account/login/',
|
url: url,
|
||||||
type: "POST",
|
type: "POST",
|
||||||
// async: true,
|
// async: true,
|
||||||
cache: false,
|
cache: false,
|
||||||
|
|||||||
@@ -1,13 +1,19 @@
|
|||||||
function SendRegistrationForm(el){
|
function SendRegistrationForm(el, user_id){
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
let form = el.form;
|
let form = el.form;
|
||||||
let formData = new FormData(form);
|
let formData = new FormData(form);
|
||||||
let msr = sessionStorage.getItem('mailingSubscribeRequired')
|
let url = '/user_account/password_recovery_confirm/'
|
||||||
formData.set('mailingSubscribeRequired',msr)
|
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({
|
$.ajax({
|
||||||
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
|
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
|
||||||
url: '/user_account/registration/',
|
url: url,
|
||||||
type: "POST",
|
type: "POST",
|
||||||
// async: true,
|
// async: true,
|
||||||
cache: false,
|
cache: false,
|
||||||
@@ -16,6 +22,9 @@ function SendRegistrationForm(el){
|
|||||||
// enctype: 'json',
|
// enctype: 'json',
|
||||||
data: formData,
|
data: formData,
|
||||||
success: function(data){
|
success: function(data){
|
||||||
|
|
||||||
|
document.getElementById('confirm_password').innerHTML = data.message
|
||||||
|
|
||||||
document.querySelector('.info_text').classList.add('show')
|
document.querySelector('.info_text').classList.add('show')
|
||||||
// location.href = `/profile/page/dashboard/`
|
// location.href = `/profile/page/dashboard/`
|
||||||
window.sessionStorage.removeItem('mailingSubscribeRequired')
|
window.sessionStorage.removeItem('mailingSubscribeRequired')
|
||||||
|
|||||||
@@ -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')
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,29 @@
|
|||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="call_to_reg">{% translate "Нет аккаунта?" %} <a href="/ru/profile/registration/">{% translate "Зарегистрируйтесь" %}</a></div>
|
<div class="call_to_reg">{% translate "Нет аккаунта?" %} <a href="/ru/profile/registration/">{% translate "Зарегистрируйтесь" %}</a></div>
|
||||||
|
<div class="call_to_reg" onclick="showForm()">{% translate "Восстановить пароль" %}</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<form class="password_recovery" name="password_recovery" method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
|
||||||
|
<div class="inputs_l">
|
||||||
|
<input
|
||||||
|
name="email"
|
||||||
|
type="text"
|
||||||
|
placeholder="{{ p_login }}"
|
||||||
|
{% if form.data.username %} value="{{ form.data.username }}"{% endif %}
|
||||||
|
id="login_email_input"
|
||||||
|
>
|
||||||
|
{% if form.username and form.errors.username %}
|
||||||
|
<span>{{ form.errors.username }}</span>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
<div class="button_register "><button class="recovery" onclick="SendLoginForm(this)">{% translate "Восстановить" %}</button></div>
|
||||||
|
|
||||||
|
|
||||||
|
</form>
|
||||||
</section>
|
</section>
|
||||||
107
templates/forms/f_password_recovery.html
Normal file
107
templates/forms/f_password_recovery.html
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
{% load i18n %}
|
||||||
|
|
||||||
|
{% trans "Пароль *" as p_password %}
|
||||||
|
{% trans "Подтвердить пароль *" as p_con_password %}
|
||||||
|
|
||||||
|
<section class="register" id="confirm_password">
|
||||||
|
<h1>{% translate "Восстановление пароля" %}</h1>
|
||||||
|
|
||||||
|
|
||||||
|
<form
|
||||||
|
name="password_recovery"
|
||||||
|
method="POST"
|
||||||
|
>
|
||||||
|
{% csrf_token %}
|
||||||
|
|
||||||
|
<div class="inputs">
|
||||||
|
<div class="inp_firstname">
|
||||||
|
<input
|
||||||
|
name="pass"
|
||||||
|
onkeydown = "hideErrors(this)"
|
||||||
|
type="password"
|
||||||
|
placeholder="{{ p_password }}"
|
||||||
|
{% if form.data.password %} value="{{ form.data.password }}"{% endif %}>
|
||||||
|
|
||||||
|
{% if form.errors and form.errors.password %}
|
||||||
|
<span>{{ form.errors.password }}</span>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div><input
|
||||||
|
name="pass_confirm"
|
||||||
|
onkeydown = "hideErrors(this)"
|
||||||
|
type="password"
|
||||||
|
placeholder="{{ p_con_password }}"
|
||||||
|
{% if form.data.confirm_password %} value="{{ form.data.confirm_password }}"{% endif %}>
|
||||||
|
|
||||||
|
{% if form.errors and form.errors.confirm_password %}
|
||||||
|
<span>{{ form.errors.confirm_password }}</span>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="button_register">
|
||||||
|
<button type="submit" id="registration" class="recovery" onclick="SendRegistrationForm(this, {{ user.id }})"> {% translate "Сохранить пароль" %} </button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{##}
|
||||||
|
{##}
|
||||||
|
{#<div class="registration">#}
|
||||||
|
{# <h2>Регистрация</h2>#}
|
||||||
|
{##}
|
||||||
|
{# <div class="form_radio_btn">#}
|
||||||
|
{##}
|
||||||
|
{# <input id="radio-1" type="radio" name="radio" value="1" checked>#}
|
||||||
|
{# <label for="radio-1">Перевозчик</label>#}
|
||||||
|
{##}
|
||||||
|
{# </div>#}
|
||||||
|
{# <div class="form_radio_btn">#}
|
||||||
|
{# <input id="radio-2" type="radio" name="radio" value="2">#}
|
||||||
|
{# <label for="radio-2">Отправитель</label>#}
|
||||||
|
{# </div>#}
|
||||||
|
{##}
|
||||||
|
{# <form action="">#}
|
||||||
|
{# {% csrf_token %}#}
|
||||||
|
{# <div class="reg_inputs">#}
|
||||||
|
{# <label><input name="firstname" type="text" placeholder="Имя"{% if form.data.firstname %} value="{{ form.data.firstname }}"{% endif %}></label>#}
|
||||||
|
{# {% if form.errors and form.errors.firstname %}#}
|
||||||
|
{# <span>{{ form.errors.firstname }}</span>#}
|
||||||
|
{# {% endif %}#}
|
||||||
|
{# <label><input name="email" type="text" placeholder="E-mail"{% if form.data.email %} value="{{ form.data.email }}"{% endif %}></label>#}
|
||||||
|
{# {% if form.errors and form.errors.email %}#}
|
||||||
|
{# <span>{{ form.errors.email }}</span>#}
|
||||||
|
{# {% endif %}#}
|
||||||
|
{# <label><input name="password" type="text" placeholder="Пароль"{% if form.data.password %} value="{{ form.data.password }}"{% endif %}></label>#}
|
||||||
|
{# {% if form.errors and form.errors.password %}#}
|
||||||
|
{# <span>{{ form.errors.password }}</span>#}
|
||||||
|
{# {% endif %}#}
|
||||||
|
{# <label><input name="lastname" type="text" placeholder="Фамилия"{% if form.data.lastname %} value="{{ form.data.lastname }}"{% endif %}></label>#}
|
||||||
|
{# {% if form.errors and form.errors.lastname %}#}
|
||||||
|
{# <span>{{ form.errors.lastname }}</span>#}
|
||||||
|
{# {% endif %}#}
|
||||||
|
{# <label><input name="tel" type="text" placeholder="Телефон"{% if form.data.tel %} value="{{ form.data.tel }}"{% endif %}></label>#}
|
||||||
|
{# {% if form.errors and form.errors.tel %}#}
|
||||||
|
{# <span>{{ form.errors.tel }}</span>#}
|
||||||
|
{# {% endif %}#}
|
||||||
|
{# <label><input name="confirm_password" type="text" placeholder="Подтвердить пароль"{% if form.data.confirm_password %} value="{{ form.data.confirm_password }}"{% endif %}></label>#}
|
||||||
|
{# {% if form.errors and form.errors.confirm_password %}#}
|
||||||
|
{# <span>{{ form.errors.confirm_password }}</span>#}
|
||||||
|
{# {% endif %}#}
|
||||||
|
{# </div>#}
|
||||||
|
{##}
|
||||||
|
{# <input type="checkbox"> <p>Регистрируясь, я соглашаюсь с Лицензионным соглашениеми и Политикой конфиденциальности</p>#}
|
||||||
|
{##}
|
||||||
|
{# <div class="reg_button">#}
|
||||||
|
{# <button id="registration" onclick="SendRegistrationForm(this)"> Зарегистрироваться </button>#}
|
||||||
|
{# </div>#}
|
||||||
|
{# </form>#}
|
||||||
|
{##}
|
||||||
|
{##}
|
||||||
|
{##}
|
||||||
|
{#</div>#}
|
||||||
10
templates/pages/profile/p_password_recovery.html
Normal file
10
templates/pages/profile/p_password_recovery.html
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{% extends 'tb_base.html' %}
|
||||||
|
{% load static %}
|
||||||
|
|
||||||
|
{% block meta %}
|
||||||
|
<script src='{% static "js/registration.js" %}'></script>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
{% include 'forms/f_password_recovery.html' %}
|
||||||
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user