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)
@user = user
@subject= "Welcome to JamKazam and JamClass online lessons!"
@subject= "Welcome to JamKazam!"
sendgrid_category "Welcome"
sendgrid_unique_args :type => "welcome_message"

View File

@ -27,7 +27,11 @@ module JamRuby
# before_save :stringify_avatar_info, :if => :updating_avatar
def create_slug
self.slug
if self.slug.blank?
puts "SELF ID #{self.id}"
self.slug = self.id.to_s
end
self.save!
end
@ -40,6 +44,19 @@ module JamRuby
end
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
end

View File

@ -280,7 +280,7 @@ module JamRuby
end
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?
retailer = Retailer.new
retailer.user = self

View File

@ -6,6 +6,18 @@ describe Retailer do
FactoryGirl.create(:retailer)
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
retailer = FactoryGirl.create(:retailer)
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} />
<div className="field password">
<label>Retailer Password:</label>
<input type="password" defaultValue="" placeholder="leave blank for no change"/>
</div>
<div className="field password">
<div className="scooter">
<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}
{processSaleUrl} <span className="usage-hint">(enter Administrator/password to access this page)</span>
</div>
</div>
<h4>Payments</h4>

View File

@ -5,8 +5,9 @@ rest = context.JK.Rest()
render: () ->
if this.props.retailer.large_photo_url?
logoImg = `<img src={this.props.retailer.large_photo_url}/>`
logo = `<div className="retailer-logo">
<img src={this.props.retailer.large_photo_url}/>
{logoImg}
<div className="retailer-name">
{this.props.retailer.name}
</div>

View File

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

View File

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