mirror of
				https://github.com/jumpserver/jumpserver.git
				synced 2025-10-31 13:52:04 +00:00 
			
		
		
		
	* [Update]更改英文登录界面标题,可两行 * [Update] 更改用户通过邮箱修改密码后,该链接就失效 * [Update]更改页面左上角logo_text图片 * [Update] 优化发送邮箱改密连接失效代码 * [Update] 优化发送邮箱改密连接失效代码(2) * [Update] 优化发送邮箱改密连接失效代码(3) * [Update] 更新interface一键恢复默认的翻译 * [Update] 更改登录失败 用户名密码错误信息的翻译 * [Update] 优化生成token并设置缓存的代码
		
			
				
	
	
		
			38 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
| # -*- coding: utf-8 -*-
 | |
| #
 | |
| 
 | |
| from django import forms
 | |
| from django.contrib.auth.forms import AuthenticationForm
 | |
| from django.utils.translation import gettext_lazy as _
 | |
| from captcha.fields import CaptchaField
 | |
| 
 | |
| 
 | |
| class UserLoginForm(AuthenticationForm):
 | |
|     username = forms.CharField(label=_('Username'), max_length=100)
 | |
|     password = forms.CharField(
 | |
|         label=_('Password'), widget=forms.PasswordInput,
 | |
|         max_length=128, strip=False
 | |
|     )
 | |
| 
 | |
|     error_messages = {
 | |
|         'invalid_login': _(
 | |
|             "Please enter a correct username and password. Note that both "
 | |
|             "fields may be case-sensitive."
 | |
|         ),
 | |
|         'inactive': _("This account is inactive."),
 | |
|     }
 | |
| 
 | |
|     def confirm_login_allowed(self, user):
 | |
|         if not user.is_staff:
 | |
|             raise forms.ValidationError(
 | |
|                 self.error_messages['inactive'],
 | |
|                 code='inactive',)
 | |
| 
 | |
| 
 | |
| class UserLoginCaptchaForm(UserLoginForm):
 | |
|     captcha = CaptchaField()
 | |
| 
 | |
| 
 | |
| class UserCheckOtpCodeForm(forms.Form):
 | |
|     otp_code = forms.CharField(label=_('MFA code'), max_length=6)
 |