@@ -537,6 +537,7 @@ func TestIsAuthenticated(t *testing.T) {
537537 sessionOffline bool
538538 username string
539539 forceProviderAuthentication bool
540+ disableLocalPassword bool
540541 userDoesNotBecomeOwner bool
541542 allUsersAllowed bool
542543 extraGroups []string
@@ -700,6 +701,14 @@ func TestIsAuthenticated(t *testing.T) {
700701 },
701702 address : "127.0.0.1:31315" ,
702703 },
704+ "Authenticating_with_device_auth_completes_without_newpassword_when_local_password_is_disabled" : {
705+ firstSecret : "-" ,
706+ disableLocalPassword : true ,
707+ },
708+ "Authenticating_with_qrcode_completes_without_newpassword_when_local_password_is_disabled" : {
709+ firstSecret : "-" ,
710+ disableLocalPassword : true ,
711+ },
703712
704713 "Error_when_authentication_data_is_invalid" : {invalidAuthData : true },
705714 "Error_when_secret_can_not_be_decrypted" : {firstMode : authmodes .Password , badFirstKey : true },
@@ -776,6 +785,17 @@ func TestIsAuthenticated(t *testing.T) {
776785 token : & tokenOptions {deviceIsDisabled : true },
777786 sessionOffline : true ,
778787 },
788+ "Error_when_mode_is_password_and_local_password_is_disabled" : {
789+ firstMode : authmodes .Password ,
790+ disableLocalPassword : true ,
791+ token : & tokenOptions {},
792+ },
793+ "Error_when_session_is_for_changing_password_and_local_password_is_disabled" : {
794+ sessionMode : sessionmode .ChangePassword ,
795+ firstMode : authmodes .Password ,
796+ disableLocalPassword : true ,
797+ token : & tokenOptions {},
798+ },
779799 "Error_when_mode_is_invalid" : {firstMode : "invalid" },
780800 }
781801 for name , tc := range tests {
@@ -805,6 +825,7 @@ func TestIsAuthenticated(t *testing.T) {
805825 firstUserBecomesOwner : ! tc .userDoesNotBecomeOwner ,
806826 allUsersAllowed : tc .allUsersAllowed ,
807827 forceProviderAuthentication : tc .forceProviderAuthentication ,
828+ disableLocalPassword : tc .disableLocalPassword ,
808829 extraGroups : tc .extraGroups ,
809830 ownerExtraGroups : tc .ownerExtraGroups ,
810831 supportsDeviceRegistration : tc .providerSupportsDeviceRegistration ,
0 commit comments