Skip to content

Commit

Permalink
Merge branch 'master' of git@github.com:devchix/DailyTasks
Browse files Browse the repository at this point in the history
  • Loading branch information
Nola Stowe committed Jul 22, 2010
2 parents d042cd8 + b50190f commit ac920fa
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 10 deletions.
10 changes: 9 additions & 1 deletion app/models/user.rb
Expand Up @@ -2,10 +2,18 @@ class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :http_authenticatable, :token_authenticatable, :confirmable, :lockable, :timeoutable and :activatable
devise :registerable, :authenticatable, :recoverable,
:rememberable, :trackable, :validatable
:rememberable, :trackable, :validatable, :confirmable, :lockable, :timeoutable, :activatable

# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation

has_many :tasks
def validate_on_create
valid_addresses = [ "somerset@gmail.com", "rebecca.gutterman@gmail.com", "mrnicksgirl@gmail.com", "beverly@beverlynelson.net"]
if valid_addresses.include? email
else
message = email+" not in whitelist, application is restricted to approved users during beta."
errors.add("email ",message)
end
end
end
2 changes: 2 additions & 0 deletions app/views/layouts/application.html.haml
Expand Up @@ -41,5 +41,7 @@
.flash
%p{:style => "color: green"}
=flash[:notice]
%p{:style => "color: red"}
= flash[:alert]
.container
=yield
24 changes: 17 additions & 7 deletions config/initializers/devise.rb
Expand Up @@ -2,7 +2,7 @@
# four configuration values can also be set straight in your models.
Devise.setup do |config|
# Configure the e-mail address which will be shown in DeviseMailer.
config.mailer_sender = "please-change-me@config-initializers-devise.com"
config.mailer_sender = "dailytasksapp@gmail.com"

# Configure the content type of DeviseMailer mails (defaults to text/html")
# config.mailer_content_type = "text/plain"
Expand Down Expand Up @@ -35,29 +35,29 @@
# ==> Configuration for :confirmable
# The time you want give to your user to confirm his account. During this time
# he will be able to access your application without confirming. Default is nil.
# config.confirm_within = 2.days
config.confirm_within = 2.hours

# ==> Configuration for :rememberable
# The time the user will be remembered without asking for credentials again.
# config.remember_for = 2.weeks
config.remember_for = 2.weeks

# ==> Configuration for :timeoutable
# The time you want to timeout the user session without activity. After this
# time the user will be asked for credentials again.
# config.timeout_in = 10.minutes
config.timeout_in = 10.minutes

# ==> Configuration for :lockable
# Number of authentication tries before locking an account.
# config.maximum_attempts = 20
config.maximum_attempts = 20

# Defines which strategy will be used to unlock an account.
# :email = Sends an unlock link to the user email
# :time = Reanables login after a certain ammount of time (see :unlock_in below)
# :both = enables both strategies
# config.unlock_strategy = :both
config.unlock_strategy = :both

# Time interval to unlock the account if :time is enabled as unlock_strategy.
# config.unlock_in = 1.hour
config.unlock_in = 1.hour

# ==> Configuration for :token_authenticatable
# Defines name of the authentication token params key
Expand Down Expand Up @@ -102,4 +102,14 @@
# config.default_url_options do
# { :locale => I18n.locale }
# end

ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => 'domain.com',
:user_name => 'dailytasksapp@gmail.com',
:password => 'devchix!',
:authentication => 'plain',
:enable_starttls_auto => true
}
end
6 changes: 4 additions & 2 deletions db/migrate/20100708012534_devise_create_users.rb
Expand Up @@ -6,8 +6,10 @@ def self.up
t.recoverable
t.rememberable
t.trackable
# t.lockable

t.lockable
t.timeoutable
t.activatable

t.timestamps
end

Expand Down

0 comments on commit ac920fa

Please sign in to comment.