Skip to content

Commit

Permalink
Allow setting a security code when one is required but not set yet.
Browse files Browse the repository at this point in the history
  • Loading branch information
adenexter committed Mar 20, 2017
1 parent 78c707f commit 5151b70
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/nemo-devicelock/host/hostauthenticator.cpp
Expand Up @@ -112,7 +112,13 @@ bool HostAuthenticator::authorizeSecurityCodeSettings(unsigned long)

bool HostAuthenticator::isSecurityCodeSet() const
{
return availability() != HostAuthenticationInput::AuthenticationNotRequired;
switch (availability()) {
case HostAuthenticationInput::AuthenticationNotRequired:
case HostAuthenticationInput::SecurityCodeRequired:
return false;
default:
return true;
}
}

void HostAuthenticator::authenticate(
Expand Down Expand Up @@ -174,14 +180,14 @@ void HostAuthenticator::handleChangeSecurityCode(const QString &client, const QV

switch (availability()) {
case AuthenticationNotRequired:
case SecurityCodeRequired:
m_state = EnteringNewSecurityCode;
authenticationStarted(Authenticator::SecurityCode, AuthenticationInput::EnterNewSecurityCode);
break;
case CanAuthenticateSecurityCode:
case CanAuthenticate:
authenticationStarted(Authenticator::SecurityCode, AuthenticationInput::EnterSecurityCode);
break;
case SecurityCodeRequired:
case ManagerLocked:
case TemporarilyLocked:
case PermanentlyLocked:
Expand Down
3 changes: 3 additions & 0 deletions src/nemo-devicelock/host/hostdevicelock.cpp
Expand Up @@ -371,6 +371,9 @@ void HostDeviceLock::stateChanged()
case PermanentlyLocked:
m_lockState = DeviceLock::PermanentLockout;
break;
case SecurityCodeRequired:
m_lockState = DeviceLock::Locked;
break;
default:
m_lockState = isLocked()
? DeviceLock::Locked
Expand Down

0 comments on commit 5151b70

Please sign in to comment.