瀏覽代碼

email verification working

tags/v0.1.6
Jonathan Cobb 5 年之前
父節點
當前提交
008f0967d3
共有 7 個文件被更改,包括 32 次插入14 次删除
  1. +2
    -0
      bubble-server/src/main/java/bubble/model/account/AccountContact.java
  2. +3
    -3
      bubble-server/src/main/java/bubble/resources/account/AuthResource.java
  3. +4
    -4
      bubble-server/src/main/java/bubble/service/account/StandardAccountMessageService.java
  4. +4
    -3
      bubble-server/src/main/resources/message_templates/email/en_US/request/verify/account/message.hbs
  5. +16
    -2
      bubble-server/src/main/resources/message_templates/server/en_US/post_auth/ResourceMessages.properties
  6. +2
    -1
      bubble-server/src/main/resources/message_templates/sms/en_US/request/verify/account/message.hbs
  7. +1
    -1
      bubble-web

+ 2
- 0
bubble-server/src/main/java/bubble/model/account/AccountContact.java 查看文件

@@ -54,6 +54,8 @@ public class AccountContact implements Serializable {
@HasValue(message="err.cloudServiceType.required")
@Getter @Setter private CloudServiceType type;
@JsonIgnore public boolean isAuthenticator () { return type == CloudServiceType.authenticator; }
@JsonIgnore public boolean getIsEmail () { return type == CloudServiceType.email; }
@JsonIgnore public boolean getIsSms () { return type == CloudServiceType.sms; }

@Getter @Setter private Boolean verified = null;
public boolean verified () { return bool(verified); }


+ 3
- 3
bubble-server/src/main/java/bubble/resources/account/AuthResource.java 查看文件

@@ -259,15 +259,15 @@ public class AuthResource {
final Account caller = optionalUserPrincipal(ctx);

final AccountMessage approval = messageService.approve(caller, getRemoteHost(req), token, data);
if (approval == null) return notFound(token);
if (approval == null) return invalid("err.token.invalid");
final Account account = validateCallerForApproveOrDeny(caller, approval, token);

if (approval.getMessageType() == AccountMessageType.confirmation) {
if (account == null) return notFound(approval.getAccount());
if (account == null) return invalid("err.token.invalid");
if (approval.getAction() == AccountAction.login) {
return ok(account.setToken(sessionDAO.create(account)));
} else {
return ok();
return ok_empty();
}
}



+ 4
- 4
bubble-server/src/main/java/bubble/service/account/StandardAccountMessageService.java 查看文件

@@ -2,8 +2,8 @@ package bubble.service.account;

import bubble.cloud.auth.AuthenticationDriver;
import bubble.dao.account.AccountDAO;
import bubble.dao.account.message.AccountMessageDAO;
import bubble.dao.account.AccountPolicyDAO;
import bubble.dao.account.message.AccountMessageDAO;
import bubble.dao.cloud.CloudServiceDAO;
import bubble.model.account.Account;
import bubble.model.account.AccountContact;
@@ -202,7 +202,7 @@ public class StandardAccountMessageService implements AccountMessageService {
String json = tokens.get(token);
if (json == null) {
log.warn("captureResponse("+type+"): regular token not found: "+token);
return null;
throw invalidEx("err.token.invalid");
}

if (NUMERIC_PATTERN.matcher(json).matches()) {
@@ -211,7 +211,7 @@ public class StandardAccountMessageService implements AccountMessageService {
json = tokens.get(numericToken);
if (json == null) {
log.warn("captureResponse("+type+"): numeric token not found: "+numericToken+" (token="+token+")");
return null;
throw invalidEx("err.token.invalid");
}
}

@@ -229,7 +229,7 @@ public class StandardAccountMessageService implements AccountMessageService {
.setTarget(amc.getMessage().getTarget());

if (data != null && !getCompletionHandler(toCreate).validate(toCreate, data)) {
throw invalidEx("err.request.invalid", type+" request was invalid", json(data));
throw invalidEx("err.token.invalid", type+" request was invalid", json(data));
}

final AccountMessage message = messageDAO.create(toCreate);


+ 4
- 3
bubble-server/src/main/resources/message_templates/email/en_US/request/verify/account/message.hbs 查看文件

@@ -9,16 +9,17 @@ Contact information has been added to your account named '{{account.name}}' on {

If you did not make this request or would like to cancel this request, please click this link:

{{configuration.publicUriBase}}/me/deny?t={{confirmationToken}}
{{configuration.publicUriBase}}/me/action?deny={{confirmationToken}}

----------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------
{{#if contact.isEmail}}
If you DID make this request and are ready to verify this contact information, click the link below.

{{configuration.publicUriBase}}/me/approve?t={{confirmationToken}}
{{configuration.publicUriBase}}/me/action?approve={{confirmationToken}}

----------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------
{{/if}}

Thank you for using Bubble!

+ 16
- 2
bubble-server/src/main/resources/message_templates/server/en_US/post_auth/ResourceMessages.properties 查看文件

@@ -37,6 +37,7 @@ field_label_auto_update_new_drivers_and_apps=Automatic Updates for New Drivers a
button_label_update_profile=Update
link_label_change_password=Change Password
link_label_account_policy=Account Policy and Contact Info
message_profile_update_success=Profile update was successful

# Time duration fields
time_duration_options=minutes,hours,days
@@ -73,6 +74,11 @@ field_label_policy_contact_type_sms=SMS
field_label_policy_contact_type_sms_field=SMS-Enabled Phone Number
field_label_policy_contact_type_authenticator=Authentication App
field_label_policy_contact_verified=Verified
field_label_policy_contact_verify_code=Enter Verification Code
button_label_submit_verify_code=Verify
message_verify_authenticator_preamble=Install the Google Authenticator app on your device, then scan the QR code shown here and enter the code it displays.
message_verify_authenticator_backupCodes=Backup Codes
message_verify_authenticator_backupCodes_description=If you lose your device or don't have access to it, you can use one of these backup codes. Write them down in a safe place.
field_label_policy_contact_requiredForNetworkUnlock=Required to unlock a new Bubble
field_label_policy_contact_requiredForNetworkUnlock_icon=fa fa-unlock
field_label_policy_contact_requiredForNodeOperations=Required for operations on your Bubble
@@ -93,7 +99,7 @@ field_label_policy_contact_authFactors=not_required,required,sufficient
field_label_policy_contact_authFactor=Authentication Factor
field_label_policy_contact_authFactor_icon=fa fa-passport
field_label_policy_contact_authFactor_name_not_required=Not Required
field_label_policy_contact_authFactor_name_not_required_icon=fa fa-circle
field_label_policy_contact_authFactor_name_not_required_icon=fa fa-minus
field_label_policy_contact_authFactor_description_not_required=Not a required Auth Factor to approve any operation
field_label_policy_contact_authFactor_name_required=Required
field_label_policy_contact_authFactor_name_required_icon=fa fa-check-double
@@ -103,7 +109,7 @@ field_label_policy_contact_authFactor_name_sufficient_icon=fa fa-check
field_label_policy_contact_authFactor_description_sufficient=If an operation is approved via this method (in addition to approval by all Required Auth Factors, if any), then the operation will be allowed
field_label_policy_contact_value_enabled_icon=fa fa-check
field_label_policy_contact_value_enabled_name=Enabled
field_label_policy_contact_value_disabled_icon=fa fa-circle
field_label_policy_contact_value_disabled_icon=fa fa-minus
field_label_policy_contact_value_disabled_name=Disabled
field_label_policy_contact_value_not_applicable_icon=fa fa-times-circle
field_label_policy_contact_value_not_applicable_name=N/A
@@ -115,6 +121,13 @@ button_label_remove_contact_icon=fa fa-trash-alt
form_label_title_account_add_contact=Add New Contact/Authorization
button_label_add_contact=Add

# Inbound approve/deny via ActionPage -> PolicyPage
message_action_processing=Processing
message_inbound_approve=Approval
message_inbound_deny=Denial
message_inbound_invalid=Invalid request
message_inbound_success=was successful
message_inbound_failure=failed

# Networks table
loading_networks=Loading bubbles...
@@ -361,6 +374,7 @@ err.tgzB64.required=tgzB64 is required
err.timezone.unknown=An error ocurred trying to determine the time zone
err.timezone.length=Time zone is too long
err.timezone.required=Time zone is requird
err.token.invalid=Code is incorrect
err.totpKey.length=TOTP key is required
err.type.notVerifiable=Type is not verifiable
err.type.invalid=Type is invalid


+ 2
- 1
bubble-server/src/main/resources/message_templates/sms/en_US/request/verify/account/message.hbs 查看文件

@@ -1 +1,2 @@
{{network.networkDomain}}: Verification code: {{confirmationToken}}
{{network.networkDomain}}: {{#if contact.isSms}}Verification code: {{confirmationToken}}{{else}}{{#if contact.isEmail}}Email added: {{contact.info}}.{{else}}Auth added: {{contact.type}}{{/if}}
Deny with code: {{confirmationToken}}{{/if}}

+ 1
- 1
bubble-web

@@ -1 +1 @@
Subproject commit 614895af758da790d8b80666fbc9ca969172760a
Subproject commit cef8b32a48f3b7a94e5f6a2c34bc0f66f1733cdb

Loading…
取消
儲存