posa/retailer fixes

This commit is contained in:
Seth Call 2016-10-07 09:55:16 -05:00
parent 1652dabb53
commit de8324e87d
8 changed files with 63 additions and 15 deletions

View File

@ -120,7 +120,7 @@ module JamRuby
def retailer_owner_welcome_message(user) def retailer_owner_welcome_message(user)
@user = user @user = user
@subject= "Welcome to JamKazam and JamClass online lessons!" @subject= "Welcome to JamKazam!"
sendgrid_category "Welcome" sendgrid_category "Welcome"
sendgrid_unique_args :type => "welcome_message" sendgrid_unique_args :type => "welcome_message"

View File

@ -27,7 +27,11 @@ module JamRuby
# before_save :stringify_avatar_info, :if => :updating_avatar # before_save :stringify_avatar_info, :if => :updating_avatar
def create_slug def create_slug
self.slug if self.slug.blank?
puts "SELF ID #{self.id}"
self.slug = self.id.to_s
end
self.save! self.save!
end end
@ -40,6 +44,19 @@ module JamRuby
end end
def matches_password(password) def matches_password(password)
if password.blank?
return false
end
puts "self.encrypted_password #{self.encrypted_password}"
begin
# we init passwordfield as a UUID, which is a bogus hash; so if we see UUId, we know retailer has no password yet
UUIDTools::UUID.parse(self.encrypted_password)
return false
rescue ArgumentError
end
BCrypt::Password.new(self.encrypted_password) == password BCrypt::Password.new(self.encrypted_password) == password
end end

View File

@ -280,7 +280,7 @@ module JamRuby
end end
if retailer_interest && !retailer_interest_was if retailer_interest && !retailer_interest_was
AdminMailer.partner({body: "#{email} signed up via the https://www.jamkazam.com/landing/jamclass/retailer page.\n\nFull list is here: https://www.jamkazam.com/admin/admin/retailer_interests", subject: "#{email} is interested in retailer program"}).deliver_now AdminMailer.partner({body: "#{email} signed up via the https://www.jamkazam.com/landing/jamclass/retailers page.\n\nFull list is here: https://www.jamkazam.com/admin/admin/retailer_interests", subject: "#{email} is interested in retailer program"}).deliver_now
if owned_retailer.nil? if owned_retailer.nil?
retailer = Retailer.new retailer = Retailer.new
retailer.user = self retailer.user = self

View File

@ -6,6 +6,18 @@ describe Retailer do
FactoryGirl.create(:retailer) FactoryGirl.create(:retailer)
end end
it "doesn't match uuid password" do
retailer= FactoryGirl.create(:retailer)
retailer.reload
retailer.matches_password('hha').should be false
end
it "automatic slug creation" do
retailer= FactoryGirl.create(:retailer, slug: nil)
retailer.id.should_not be_blank
retailer.slug.should eql retailer.id.to_s
end
it "has correct associations" do it "has correct associations" do
retailer = FactoryGirl.create(:retailer) retailer = FactoryGirl.create(:retailer)
retailer.slug.should eql retailer.id retailer.slug.should eql retailer.id

View File

@ -287,14 +287,24 @@ profileUtils = context.JK.ProfileUtils
<SelectLocation defaultText={'Not Specified'} showCity={true} hideCountry={true} onItemChanged={this.handleLocationChange} selectedCountry={'US'} selectedCity={this.state.retailer.city} selectedRegion={this.state.retailer.state} /> <SelectLocation defaultText={'Not Specified'} showCity={true} hideCountry={true} onItemChanged={this.handleLocationChange} selectedCountry={'US'} selectedCity={this.state.retailer.city} selectedRegion={this.state.retailer.state} />
<div className="field password"> <div className="field password">
<label>Retailer Password:</label>
<input type="password" defaultValue="" placeholder="leave blank for no change"/>
</div> </div>
<div className="field password"> <div className="field password">
<label>Process Sale URL:</label> <div className="scooter">
{processSaleUrl} <label>Retailer Username:</label>
<label >Administrator</label>
</div>
<div className="scooter">
<label>Retailer Password:</label>
<input type="password" defaultValue="" placeholder="leave blank for no change"/>
</div>
<div>
<label>Process Sale URL:</label>
{processSaleUrl} <span className="usage-hint">(enter Administrator/password to access this page)</span>
</div>
</div> </div>
<h4>Payments</h4> <h4>Payments</h4>

View File

@ -5,13 +5,14 @@ rest = context.JK.Rest()
render: () -> render: () ->
if this.props.retailer.large_photo_url? if this.props.retailer.large_photo_url?
logo = `<div className="retailer-logo"> logoImg = `<img src={this.props.retailer.large_photo_url}/>`
<img src={this.props.retailer.large_photo_url}/> logo = `<div className="retailer-logo">
<div className="retailer-name"> {logoImg}
{this.props.retailer.name} <div className="retailer-name">
</div> {this.props.retailer.name}
<br className="clearall"/> </div>
</div>` <br className="clearall"/>
</div>`
ctaButtonText = 'ACTIVATE' ctaButtonText = 'ACTIVATE'
if @state.processing if @state.processing

View File

@ -38,6 +38,14 @@
} }
} }
} }
.usage-hint {
font-size:12px;
text-decoration:underline;
margin-left:10px;
}
.scooter {
margin-bottom:10px;
}
.store-header { .store-header {
float: left; float: left;
padding-top: 10px; padding-top: 10px;

View File

@ -57,6 +57,7 @@ body.landing_page.full.posa_activation .landing-content {
margin-bottom:20px; margin-bottom:20px;
img { img {
float:left; float:left;
margin-right:20px;
} }
} }
@ -65,7 +66,6 @@ body.landing_page.full.posa_activation .landing-content {
line-height:200px; line-height:200px;
height:200px; height:200px;
float:left; float:left;
margin-left:20px;
font-size:1.5rem; font-size:1.5rem;
} }
} }