jobshop 0.0.15 → 0.0.16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b40482d948a58938955b3133971e53032caa54fb
4
- data.tar.gz: fadf4c7b7f987f810b732a1eeded4ca4edaf2be7
3
+ metadata.gz: 8836a59044956ad6f3a87a7ae6d1f8ed555d4206
4
+ data.tar.gz: 784ebaafda1c6e0e7f55c35eb9541961b0c07b3f
5
5
  SHA512:
6
- metadata.gz: ca99cbcb216815970ea4111c708c74450f49942c536ff14953c6f7c78f2d465dbb9bb4c6e1163823a1fe4aa81ee1fe482743d2539eeb3605c84d919e4ea0c5cf
7
- data.tar.gz: 550c1aa4d0e8ac61a9e38b2c5742200f49d1ba819b8f9750f805941036b0f18ebb2914b879d8d1cd0e4c9c7e520e93ce7ae3ff05712a407b6753e1f38445d247
6
+ metadata.gz: d497a7ad7a2cd3fdd6cce2fe9430fb10bc1776bb4d82088128adbd29063045b8a35304170e8d6b203752df4682f1c260da1233f0640844ef62921a09ec54feda
7
+ data.tar.gz: 5ca0c588a1c163ca5d51e33584732f9afabc97d58ff1d871d59c9e7904964c0bc8083a7b5b2099b3ca6a3727f9af76b7808aa8cb7030147bdf1f07a7d2d2293c
@@ -1,6 +1,7 @@
1
1
  body.sessions-new,
2
2
  body.lookups-show,
3
- body.registrations-new {
3
+ body.registrations-new,
4
+ body.registrations-create {
4
5
  header {
5
6
  @extend .mdl-color--white;
6
7
  @extend .mdl-color-text--black;
@@ -14,7 +14,7 @@ module Jobshop
14
14
  before_action :authenticate_user!
15
15
 
16
16
  # after_action :verify_authorized, except: :index
17
- # after_action :verify_policy_scoped, :only => :index
17
+ # after_action :verify_policy_scoped, only: :index
18
18
 
19
19
  private
20
20
 
@@ -7,6 +7,15 @@ module Jobshop
7
7
  belongs_to :team, optional: true
8
8
  has_one :default_dashboard, class_name: "Jobshop::Dashboard", through: :team
9
9
 
10
+ validates :email,
11
+ presence: { if: :email_required? },
12
+ format: { if: :email_required?, with: /\A[^@\s]+@[^@\s]+\z/ },
13
+ uniqueness: { if: :email_changed?, scope: :team_id }
14
+
15
+ validates :password,
16
+ presence: { if: :password_required? },
17
+ confirmation: { if: :password_required? }
18
+
10
19
  private
11
20
 
12
21
  def generate_email_authentication_token
@@ -15,5 +24,13 @@ module Jobshop
15
24
  break token unless Jobshop::User.where(email_authentication_token: token).first
16
25
  end
17
26
  end
27
+
28
+ def password_required?
29
+ !persisted? || !password.nil? || !password_confirmation.nil?
30
+ end
31
+
32
+ def email_required?
33
+ true
34
+ end
18
35
  end
19
36
  end
@@ -1,14 +1,12 @@
1
1
  module Jobshop
2
2
  module Generators
3
- class TeamGenerator < Rails::Generators::NamedBase
3
+ class TeamGenerator < Rails::Generators::Base
4
4
  source_root File.expand_path("../templates", __FILE__)
5
5
 
6
6
  desc "Create a jobshop team."
7
7
 
8
- attr_reader :team, :link_text, :first_team
9
-
10
8
  def require_environment
11
- ENV['RAILS_ENV'] ||= "development"
9
+ ENV["RAILS_ENV"] ||= "development"
12
10
  abort "Please run this command within a Rails app." unless Rails.root
13
11
 
14
12
  environment_filename = File.expand_path(
@@ -18,11 +16,11 @@ module Jobshop
18
16
  end
19
17
 
20
18
  def create_team
21
- @team = ::Jobshop::Team.create!(name: name)
19
+ @team = ::Jobshop::Team.create!
22
20
  end
23
21
 
24
22
  def generate_token
25
- @token = team.generate_registration_token
23
+ @token = @team.generate_registration_token
26
24
  end
27
25
 
28
26
  def generate_secure_registration_link
@@ -31,7 +29,7 @@ module Jobshop
31
29
  # TODO: Give environments besides development a decent host and
32
30
  # protocol. HTTPS isn't mandatory in production but it is very, VERY
33
31
  # highly recommended.
34
- @link_text = ::Jobshop::Engine.routes.url_helpers.
32
+ @secure_url = ::Jobshop::Engine.routes.url_helpers.
35
33
  new_team_registration_url(@team,
36
34
  protocol: link_protocol,
37
35
  host: link_host,
@@ -43,10 +41,10 @@ module Jobshop
43
41
  say <<-MESSAGE
44
42
  ### JOBSHOP - IMPORTANT INFORMATION ############################################
45
43
 
46
- Your Jobshop team "#{name}" has been initialized.
44
+ Your Jobshop team has been initialized.
47
45
  You may use the following link to complete the setup process.
48
46
 
49
- #{link_text}
47
+ #{@secure_url}
50
48
 
51
49
  This link is valid for 30 minutes from now and will expire at:
52
50
  #{30.minutes.from_now.in_time_zone("Eastern Time (US & Canada)")}
@@ -6,7 +6,7 @@ module Jobshop
6
6
  module VERSION
7
7
  MAJOR = 0
8
8
  MINOR = 0
9
- TINY = 15
9
+ TINY = 16
10
10
  PRE = nil
11
11
 
12
12
  CODE_NAME = "bump it up".freeze
@@ -22,6 +22,23 @@ namespace :jobshop do
22
22
  puts "#{team_name} | #{team.id} | #{team.owner_email} "
23
23
  end
24
24
  end
25
+
26
+ namespace :teams do
27
+ desc "Clear out teams that haven't been registered after 24 hours"
28
+ task purge: :environment do
29
+ deleted_teams = Jobshop::Team
30
+ .where(Jobshop::Team.arel_table[:registration_token_sent_at]
31
+ .lt(24.hours.ago))
32
+ .where(owner_id: nil)
33
+ .destroy_all
34
+
35
+ count = deleted_teams.count
36
+ inflection = "team".pluralize(count)
37
+ list = deleted_teams.map(&:id).join("\n")
38
+
39
+ puts "Purged #{count} #{inflection}\n#{list}"
40
+ end
41
+ end
25
42
  end
26
43
 
27
44
  %w( db:migrate db:rollback db:migrate:up db:migrate:down ).each do |t|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jobshop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frank J. Mattia
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-21 00:00:00.000000000 Z
11
+ date: 2016-07-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: coffee-rails