Merge remote-tracking branch 'origin/master'

This commit is contained in:
mhajas 2015-11-23 13:12:23 +01:00
commit 8f346a5f59
3 changed files with 11 additions and 11 deletions

View file

@ -51,18 +51,18 @@
<kc-tooltip>How far ahead should the server look just in case the token generator and server are out of time sync or counter sync?</kc-tooltip> <kc-tooltip>How far ahead should the server look just in case the token generator and server are out of time sync or counter sync?</kc-tooltip>
</div> </div>
<div class="form-group" data-ng-show="realm.otpPolicyType == 'hotp'"> <div class="form-group" data-ng-if="realm.otpPolicyType == 'hotp'">
<label class="col-md-2 control-label" for="counter">Initial Counter</label> <label class="col-md-2 control-label" for="counter">Initial Counter</label>
<div class="col-md-6"> <div class="col-md-6">
<input class="form-control" type="number" required min="1" max="120" id="counter" name="counter" data-ng-model="realm.otpPolicyInitialCounter" autofocus> <input class="form-control" type="number" data-ng-required="realm.otpPolicyType == 'hotp'" min="1" max="120" id="counter" name="counter" data-ng-model="realm.otpPolicyInitialCounter" autofocus>
</div> </div>
<kc-tooltip>What should the initial counter value be?</kc-tooltip> <kc-tooltip>What should the initial counter value be?</kc-tooltip>
</div> </div>
<div class="form-group" data-ng-show="realm.otpPolicyType == 'totp'"> <div class="form-group" data-ng-if="realm.otpPolicyType == 'totp'">
<label class="col-md-2 control-label" for="counter">OTP Token Period</label> <label class="col-md-2 control-label" for="counter">OTP Token Period</label>
<div class="col-md-6"> <div class="col-md-6">
<input class="form-control" type="number" required min="1" max="120" id="period" name="period" data-ng-model="realm.otpPolicyPeriod"> <input class="form-control" type="number" data-ng-required="realm.otpPolicyType == 'totp'" min="1" max="120" id="period" name="period" data-ng-model="realm.otpPolicyPeriod">
</div> </div>
<kc-tooltip>How many seconds should an OTP token be valid? Defaults to 30 seconds.</kc-tooltip> <kc-tooltip>How many seconds should an OTP token be valid? Defaults to 30 seconds.</kc-tooltip>
</div> </div>

View file

@ -69,12 +69,12 @@ public class RepresentationToModel {
private static Logger logger = Logger.getLogger(RepresentationToModel.class); private static Logger logger = Logger.getLogger(RepresentationToModel.class);
public static OTPPolicy toPolicy(RealmRepresentation rep) { public static OTPPolicy toPolicy(RealmRepresentation rep) {
OTPPolicy policy = new OTPPolicy(); OTPPolicy policy = new OTPPolicy();
policy.setType(rep.getOtpPolicyType()); if (rep.getOtpPolicyType() != null) policy.setType(rep.getOtpPolicyType());
policy.setLookAheadWindow(rep.getOtpPolicyLookAheadWindow()); if (rep.getOtpPolicyLookAheadWindow() != null) policy.setLookAheadWindow(rep.getOtpPolicyLookAheadWindow());
policy.setInitialCounter(rep.getOtpPolicyInitialCounter()); if (rep.getOtpPolicyInitialCounter() != null) policy.setInitialCounter(rep.getOtpPolicyInitialCounter());
policy.setAlgorithm(rep.getOtpPolicyAlgorithm()); if (rep.getOtpPolicyAlgorithm() != null) policy.setAlgorithm(rep.getOtpPolicyAlgorithm());
policy.setDigits(rep.getOtpPolicyDigits()); if (rep.getOtpPolicyDigits() != null) policy.setDigits(rep.getOtpPolicyDigits());
policy.setPeriod(rep.getOtpPolicyPeriod()); if (rep.getOtpPolicyPeriod() != null) policy.setPeriod(rep.getOtpPolicyPeriod());
return policy; return policy;
} }

View file

@ -236,7 +236,7 @@ public class RealmAdminResource {
} catch (ModelDuplicateException e) { } catch (ModelDuplicateException e) {
throw e; throw e;
} catch (Exception e) { } catch (Exception e) {
logger.error(e); logger.error(e.getMessage(), e);
return ErrorResponse.error("Failed to update " + rep.getRealm() + " Realm.", Response.Status.INTERNAL_SERVER_ERROR); return ErrorResponse.error("Failed to update " + rep.getRealm() + " Realm.", Response.Status.INTERNAL_SERVER_ERROR);
} }
} }