login with captcha
This commit is contained in:
parent
865579f8d2
commit
b79aeace36
|
@ -4,4 +4,4 @@ from captcha.fields import CaptchaField
|
||||||
class GroupsForm(forms.Form):
|
class GroupsForm(forms.Form):
|
||||||
username = forms.CharField(label="用户名", max_length=128, widget=forms.TextInput(attrs={'class': 'form-control', 'placeholder': "Username",'autofocus': ''}))
|
username = forms.CharField(label="用户名", max_length=128, widget=forms.TextInput(attrs={'class': 'form-control', 'placeholder': "Username",'autofocus': ''}))
|
||||||
password = forms.CharField(label="密码", max_length=256, widget=forms.PasswordInput(attrs={'class': 'form-control','placeholder': "Password"}))
|
password = forms.CharField(label="密码", max_length=256, widget=forms.PasswordInput(attrs={'class': 'form-control','placeholder': "Password"}))
|
||||||
captcha = CaptchaField(label='验证码', error_messages={"invalid":"验证码错误"})
|
captcha = CaptchaField(label='验证码', error_messages={"invalid":"验证码错误"})
|
||||||
|
|
|
@ -50,8 +50,10 @@
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
<script>
|
<script>
|
||||||
|
$(function(){
|
||||||
|
$('#id_captcha_1').addClass('form-control');
|
||||||
|
})
|
||||||
$('.captcha').click(function () {
|
$('.captcha').click(function () {
|
||||||
|
|
||||||
$.getJSON("/groups/refresh_captcha/", function (result) {
|
$.getJSON("/groups/refresh_captcha/", function (result) {
|
||||||
$('.captcha').attr('src', result['image_url']);
|
$('.captcha').attr('src', result['image_url']);
|
||||||
$('#id_captcha_0').val(result['key'])
|
$('#id_captcha_0').val(result['key'])
|
||||||
|
|
Loading…
Reference in New Issue