This repository has been archived by the owner on Sep 21, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(policy): add password min symbols policy pattern
Signed-off-by: Rafa Hernandez <rhernandez@teclib.com>
- Loading branch information
Showing
3 changed files
with
61 additions
and
26 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
app/src/main/java/org/flyve/mdm/agent/policies/PasswordMinSymbolsPolicy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package org.flyve.mdm.agent.policies; | ||
|
||
import android.content.Context; | ||
|
||
import org.flyve.mdm.agent.services.PoliciesDeviceManager; | ||
import org.flyve.mdm.agent.utils.FlyveLog; | ||
|
||
/* | ||
* Copyright © 2018 Teclib. All rights reserved. | ||
* | ||
* This file is part of flyve-mdm-android | ||
* | ||
* flyve-mdm-android is a subproject of Flyve MDM. Flyve MDM is a mobile | ||
* device management software. | ||
* | ||
* Flyve MDM is free software: you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; either version 3 | ||
* of the License, or (at your option) any later version. | ||
* | ||
* Flyve MDM is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* ------------------------------------------------------------------------------ | ||
* @author rafael hernandez | ||
* @date 15/5/18 | ||
* @copyright Copyright © 2018 Teclib. All rights reserved. | ||
* @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html | ||
* @link https://github.com/flyve-mdm/flyve-mdm-android | ||
* @link https://flyve-mdm.com | ||
* ------------------------------------------------------------------------------ | ||
*/ | ||
|
||
public class PasswordMinSymbolsPolicy extends BasePolicies { | ||
|
||
private static final String POLICY_NAME = "passwordMinSymbols"; | ||
|
||
public PasswordMinSymbolsPolicy(Context context) { | ||
super(context, POLICY_NAME); | ||
} | ||
|
||
@Override | ||
protected boolean process() { | ||
try { | ||
int minimum = Integer.parseInt(this.policyValue.toString()); | ||
new PoliciesDeviceManager(context).setPasswordMinimumSymbols(minimum); | ||
return true; | ||
} catch (Exception ex) { | ||
FlyveLog.e(ex.getMessage()); | ||
return false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters