Преглед на файлове

toggle auth flags

tags/v0.1.6
Jonathan Cobb преди 5 години
родител
ревизия
c15931b95a
променени са 4 файла, в които са добавени 15 реда и са изтрити 8 реда
  1. +6
    -5
      bubble-server/src/main/java/bubble/model/account/AccountContact.java
  2. +8
    -1
      bubble-server/src/main/java/bubble/resources/account/AccountsResource.java
  3. +0
    -1
      bubble-server/src/main/resources/message_templates/server/en_US/post_auth/ResourceMessages.properties
  4. +1
    -1
      bubble-web

+ 6
- 5
bubble-server/src/main/java/bubble/model/account/AccountContact.java Целия файл

@@ -31,9 +31,15 @@ import static org.cobbzilla.wizard.resources.ResourceUtil.invalidEx;
public class AccountContact implements Serializable {

public static final int MAX_NICK_LENGTH = 100;
public static final String[] UPDATE_EXCLUDE_FIELDS = {"uuid", "type", "info"};

public AccountContact(AccountContact other) { copy(this, other); }

public AccountContact update(AccountContact other) {
copy(this, other, null, UPDATE_EXCLUDE_FIELDS);
return this;
}

@Getter @Setter private String uuid = randomUUID().toString();
public boolean hasUuid () { return !empty(uuid); }
public AccountContact initUuid () { uuid = randomUUID().toString(); return this; }
@@ -78,11 +84,6 @@ public class AccountContact implements Serializable {
final List<ConstraintViolationBean> errors = c.getType().validate(c.getInfo());
if (errors != null && !errors.isEmpty()) throw invalidEx(errors);

// there must be at least one contact that can be used to unlock the network
if (!c.requiredForNetworkUnlock() && (contacts == null || Arrays.stream(contacts).noneMatch(AccountContact::requiredForNetworkUnlock))) {
throw invalidEx("err.requiredForNetworkUnlock.atLeastOneNetworkUnlockContactRequired");
}

if (c.isAuthenticator()) {
final AccountContact auth = findAuthenticator(contacts);
if (auth != null && !auth.getUuid().equals(c.getUuid())) {


+ 8
- 1
bubble-server/src/main/java/bubble/resources/account/AccountsResource.java Целия файл

@@ -147,7 +147,14 @@ public class AccountsResource {
final AccountPolicy policy = policyDAO.findSingleByAccount(c.account.getUuid());

final AccountContact existing = policy.findContact(contact);
if (existing != null && existing.isAuthenticator()) return invalid("err.authenticator.configured");
if (existing != null) {
if (existing.isAuthenticator()) return invalid("err.authenticator.configured");

// if it already exists, these fields cannot be changed
contact.setUuid(existing.getUuid());
contact.setType(existing.getType());
contact.setInfo(existing.getInfo());
}

policyDAO.update(policy.setContact(contact));
final AccountContact added = policy.findContact(contact);


+ 0
- 1
bubble-server/src/main/resources/message_templates/server/en_US/post_auth/ResourceMessages.properties Целия файл

@@ -338,7 +338,6 @@ err.refund.unknownError=An error occurred processing your refund. Please contact
err.remoteHost.length=Remote host is too long
err.remoteHost.required=Remote host is required
err.request.invalid=Request is invalid
err.requiredForNetworkUnlock.atLeastOneNetworkUnlockContactRequired=You must have at least one verified contact method that can unlock a new Bubble
err.restoreKey.invalid=Restore key is invalid
err.restoreKey.required=Restore key is required
err.role.exists=Role already exists with this name


+ 1
- 1
bubble-web

@@ -1 +1 @@
Subproject commit 6e622f75c645d258af7357991dd893d41d94c5d6
Subproject commit 614895af758da790d8b80666fbc9ca969172760a

Зареждане…
Отказ
Запис