ajax request otp
This commit is contained in:
parent
7041dfe511
commit
850d0cb5f9
1 changed files with 41 additions and 26 deletions
|
|
@ -2,37 +2,52 @@
|
|||
|
||||
{% block content %}
|
||||
|
||||
{% if form.errors %}
|
||||
<p>Your phone number and otp didn't match. Please try again.</p>
|
||||
{% endif %}
|
||||
{% if form.errors %}
|
||||
<p>Your phone number and otp didn't match. Please try again.</p>
|
||||
{% endif %}
|
||||
|
||||
{% if next %}
|
||||
{% if user.is_authenticated %}
|
||||
<p>Your account doesn't have access to this page. To proceed,
|
||||
please login with an account that has access.</p>
|
||||
{% else %}
|
||||
<p>Please login to see this page.</p>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if next %}
|
||||
{% if user.is_authenticated %}
|
||||
<p>Your account doesn't have access to this page. To proceed,
|
||||
please login with an account that has access.</p>
|
||||
{% else %}
|
||||
<p>Please login to see this page.</p>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<form method="post" action="{% url 'login' %}">
|
||||
{% csrf_token %}
|
||||
<table>
|
||||
<form method="post" action="{% url 'login' %}">
|
||||
{% csrf_token %}
|
||||
<table>
|
||||
|
||||
<tr>
|
||||
<td>{{ form.phone_number.label_tag }}</td>
|
||||
<td>{{ form.phone_number }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ form.phone_number.label_tag }}</td>
|
||||
<td>{{ form.phone_number }}</td>
|
||||
<td id="request-otp"><a class="btn btn-default">requet otp</a></td>
|
||||
<td id="otp-result"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>{{ form.otp.label_tag }}</td>
|
||||
<td>{{ form.otp }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<tr>
|
||||
<td>{{ form.otp.label_tag }}</td>
|
||||
<td>{{ form.otp }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<input type="submit" value="login" />
|
||||
<input type="hidden" name="next" value="{{ next }}" />
|
||||
</form>
|
||||
<input type="submit" value="login"/>
|
||||
<input type="hidden" name="next" value="{{ next }}"/>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
$("#request-otp").click(
|
||||
function () {
|
||||
var phoneNumber = $('#id_phone_number')[0].value;
|
||||
|
||||
$.post("/request_otp/",{'phone_number': phoneNumber},function (result) {
|
||||
console.log(result);
|
||||
$("#otp-result")[0].innerHTML = 'otp expire: ' + result['otp_expire'] ;
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
Loading…
Add table
Reference in a new issue