mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-03 22:06:07 +00:00
Set public enterprise.email_address at registration
Sets the public email address to the given email address as well as the internal enterprise.email (notification email address). The field is not mandatory any more since enterprise.email is populated from the owner's email address if no value was given.
This commit is contained in:
@@ -2,7 +2,7 @@ Darkswarm.factory "EnterpriseRegistrationService", ($http, RegistrationService,
|
||||
new class EnterpriseRegistrationService
|
||||
enterprise:
|
||||
user_ids: [CurrentUser.id]
|
||||
email: CurrentUser.email
|
||||
email_address: CurrentUser.email
|
||||
address: {}
|
||||
country: availableCountries[0]
|
||||
|
||||
@@ -55,6 +55,7 @@ Darkswarm.factory "EnterpriseRegistrationService", ($http, RegistrationService,
|
||||
excluded = [ 'address', 'country', 'id' ]
|
||||
for key, value of @enterprise when key not in excluded
|
||||
enterprise[key] = value
|
||||
enterprise.email = enterprise.email_address
|
||||
enterprise.address_attributes = @enterprise.address if @enterprise.address?
|
||||
enterprise.address_attributes.country_id = @enterprise.country.id if @enterprise.country?
|
||||
enterprise
|
||||
|
||||
@@ -17,10 +17,8 @@
|
||||
{{'enterprise_contact_required' | t}}
|
||||
.row
|
||||
.small-12.columns.field
|
||||
%label{ for: 'enterprise_email' } {{'enterprise_email' | t}}:
|
||||
%input.chunky.small-12.columns{ id: 'enterprise_email', name: 'email', type: 'email', required: true, placeholder: "eg. charlie@thefarm.com", ng: { model: 'enterprise.email' } }
|
||||
%span.error.small-12.columns{ ng: { show: "(contact.email.$error.email || contact.email.$error.required) && submitted" } }
|
||||
{{'enterprise_email_required' | t}}
|
||||
%label{ for: 'enterprise_email_address' } {{'enterprise_email_address' | t}}:
|
||||
%input.chunky.small-12.columns{ id: 'enterprise_email_address', name: 'email_address', type: 'email', placeholder: "eg. charlie@thefarm.com", ng: { model: 'enterprise.email_address' } }
|
||||
.row
|
||||
.small-12.columns.field
|
||||
%label{ for: 'enterprise_phone' } {{'enterprise_phone' | t}}:
|
||||
|
||||
Reference in New Issue
Block a user