mirror of https://github.com/jumpserver/jumpserver
Merge pull request #3034 from jumpserver/dev_bai
[Update] 是否允许用户更改/使用密钥登录,根据settings配置进行控制pull/3035/head
commit
28f0302e4d
|
@ -55,7 +55,10 @@ class AuthMixin:
|
||||||
return self.is_local
|
return self.is_local
|
||||||
|
|
||||||
def can_update_ssh_key(self):
|
def can_update_ssh_key(self):
|
||||||
return self.is_local
|
return self.can_use_ssh_key_login()
|
||||||
|
|
||||||
|
def can_use_ssh_key_login(self):
|
||||||
|
return settings.TERMINAL_PUBLIC_KEY_AUTH
|
||||||
|
|
||||||
def check_otp(self, code):
|
def check_otp(self, code):
|
||||||
from ..utils import check_otp_code
|
from ..utils import check_otp_code
|
||||||
|
|
|
@ -198,7 +198,7 @@ def check_user_valid(**kwargs):
|
||||||
if password and authenticate(username=username, password=password):
|
if password and authenticate(username=username, password=password):
|
||||||
return user, ''
|
return user, ''
|
||||||
|
|
||||||
if public_key and user.public_key and user.is_local:
|
if public_key and user.public_key and user.can_use_ssh_key_login():
|
||||||
public_key_saved = user.public_key.split()
|
public_key_saved = user.public_key.split()
|
||||||
if len(public_key_saved) == 1:
|
if len(public_key_saved) == 1:
|
||||||
if public_key == public_key_saved[0]:
|
if public_key == public_key_saved[0]:
|
||||||
|
|
Loading…
Reference in New Issue