@@ -24,6 +24,11 @@ export const DeviceStep = () => {
2424 const setStore = useEnrollmentStore ( ( state ) => state . setState ) ;
2525 const deviceState = useEnrollmentStore ( ( state ) => state . deviceState ) ;
2626 const settings = useEnrollmentStore ( ( state ) => state . enrollmentSettings ) ;
27+ const deviceManagementDisabled = useEnrollmentStore ( ( state ) =>
28+ Boolean (
29+ state . enrollmentSettings ?. admin_device_management && ! state . userInfo ?. is_admin ,
30+ ) ,
31+ ) ;
2732 const [ userPhone , userPassword ] = useEnrollmentStore (
2833 ( state ) => [ state . userInfo ?. phone_number , state . userPassword ] ,
2934 shallow ,
@@ -56,7 +61,8 @@ export const DeviceStep = () => {
5661 if (
5762 ( deviceState && deviceState . device && deviceState . configs ) ||
5863 settings ?. vpn_setup_optional ||
59- settings ?. only_client_activation
64+ settings ?. only_client_activation ||
65+ deviceManagementDisabled
6066 ) {
6167 setStore ( {
6268 loading : true ,
@@ -81,11 +87,12 @@ export const DeviceStep = () => {
8187 userPassword ,
8288 mutate ,
8389 settings ?. only_client_activation ,
90+ deviceManagementDisabled ,
8491 ] ) ;
8592
86- // If only client activation is enabled, skip manual wireguard setup
93+ // If only client activation is enabled or device management by normal users is disabled , skip manual wireguard setup
8794 useEffectOnce ( ( ) => {
88- if ( settings ?. only_client_activation ) {
95+ if ( settings ?. only_client_activation || deviceManagementDisabled ) {
8996 nextSubject . next ( ) ;
9097 }
9198 } ) ;
0 commit comments