Browse Source

upgrade devise, tweaks

pull/1/head
Nicolae Claudius 13 years ago
parent
commit
52b2e25e1e
  1. 2
      Gemfile
  2. 20
      Gemfile.lock
  3. 2
      app/helpers/application_helper.rb
  4. 2
      app/views/layouts/application.html.erb
  5. 2
      app/views/layouts/errors.html.erb
  6. 6
      app/views/layouts/public.html.erb
  7. 11
      config/initializers/devise.rb
  8. 11
      config/locales/devise.en.yml
  9. 47
      db/migrate/20110917082609_devise_create_users.rb
  10. 2
      db/samples.rb

2
Gemfile

@ -7,7 +7,7 @@ gem 'rails', '3.2.0'
# gem 'pg'
gem 'mysql2'
gem 'devise', '~> 1.5.3'
gem 'devise', '~> 2.0.4'
gem 'cancan', '~> 1.6.7'
gem 'squeel', '~> 0.9.3'
gem 'sentient_user', '~> 0.3.2'

20
Gemfile.lock

@ -6,7 +6,7 @@ GIT
GIT
remote: https://github.com/activescaffold/active_scaffold.git
revision: 987fdf05f4e5bf3e2e749e8de7bcc467c9c6c642
revision: ab2dae8cc7da5957720bf911d0a66785056fc70e
specs:
active_scaffold (3.2.0)
rails (>= 3.1.3)
@ -44,7 +44,7 @@ GEM
activesupport (3.2.0)
i18n (~> 0.6)
multi_json (~> 1.0)
arel (3.0.0)
arel (3.0.2)
bcrypt-ruby (3.0.1)
bootstrap-sass-rails (2.0.0.3)
rails (~> 3.1)
@ -85,10 +85,11 @@ GEM
daemons (1.0.10)
dalli (1.1.4)
database_cleaner (0.7.1)
devise (1.5.3)
devise (2.0.4)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.0.3)
warden (~> 1.1)
railties (~> 3.1)
warden (~> 1.1.1)
diff-lcs (1.1.3)
erubis (2.7.0)
execjs (1.3.0)
@ -114,7 +115,7 @@ GEM
highline (1.6.11)
hike (1.2.1)
i18n (0.6.0)
journey (1.0.1)
journey (1.0.3)
jquery-rails (2.0.0)
railties (>= 3.2.0.beta, < 5.0)
thor (~> 0.14)
@ -204,9 +205,10 @@ GEM
json_pure
rubyzip
sentient_user (0.3.2)
simplecov (0.4.2)
simplecov-html (~> 0.4.4)
simplecov-html (0.4.5)
simplecov (0.6.0)
multi_json (~> 1.0)
simplecov-html (~> 0.5.3)
simplecov-html (0.5.3)
spork (1.0.0rc2)
sprockets (2.1.2)
hike (~> 1.2)
@ -250,7 +252,7 @@ DEPENDENCIES
compass-rails (~> 1.0.0.rc.2)
dalli (~> 1.1.3)
database_cleaner (~> 0.7.1)
devise (~> 1.5.3)
devise (~> 2.0.4)
factory_girl_rails (~> 1.6.0)
faker (~> 1.0.1)
guard-rspec (~> 0.6.0)

2
app/helpers/application_helper.rb

@ -1,3 +1,5 @@
# encoding: UTF-8
module ApplicationHelper
FLASH_ALIASES = HashWithIndifferentAccess.new(

2
app/views/layouts/application.html.erb

@ -5,7 +5,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>EntryDNS</title>
<title><%= content_for?(:title) ? yield(:title) : "EntryDNS" %></title>
<%= stylesheet_link_tag "application" %>
<%= javascript_include_tag "application" %>

2
app/views/layouts/errors.html.erb

@ -5,7 +5,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>EntryDNS</title>
<title><%= content_for?(:title) ? yield(:title) : "EntryDNS" %></title>
<%= stylesheet_link_tag "application" %>
<%= javascript_include_tag "application" %>

6
app/views/layouts/public.html.erb

@ -5,10 +5,10 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>EntryDNS free DNS service and dynamic DNS</title>
<title><%= content_for?(:title) ? yield(:title) : "EntryDNS free DNS service and dynamic DNS" %></title>
<meta name="description" content="EntryDNS free DNS service and dynamic DNS" />
<meta name="keywords" content="DNS, free, service, dynamic, management, hosting" />
<meta name="description" content="<%= content_for?(:description) ? yield(:description) : "EntryDNS free DNS service and dynamic DNS" %>" />
<meta name="keywords" content="<%= content_for?(:keywords) ? yield(:keywords) : "DNS, free, service, dynamic, management, hosting" %>" />
<meta name="author" content="EntryDNS Team" />
<%= stylesheet_link_tag "application" %>

11
config/initializers/devise.rb

@ -74,11 +74,11 @@ Devise.setup do |config|
# ==> Configuration for :confirmable
# The time you want to give your user to confirm his account. During this time
# he will be able to access your application without confirming. Default is 0.days
# When confirm_within is zero, the user won't be able to sign in without confirming.
# When allow_unconfirmed_access_for is zero, the user won't be able to sign in without confirming.
# You can use this to let your user access some features of your application
# without confirming the account, but blocking it after a certain period
# (ie 2 days).
# config.confirm_within = 2.days
# config.allow_unconfirmed_access_for = 2.days
# Defines which key will be used when confirming an account
# config.confirmation_keys = [ :email ]
@ -87,9 +87,6 @@ Devise.setup do |config|
# The time the user will be remembered without asking for credentials again.
# config.remember_for = 2.weeks
# If true, a valid remember token can be re-used between multiple browsers.
# config.remember_across_browsers = true
# If true, extends the user's remember period when remembered via cookie.
# config.extend_remember_period = false
@ -160,10 +157,6 @@ Devise.setup do |config|
# Defines name of the authentication token params key
# config.token_authentication_key = :auth_token
# If true, authentication through token does not store user in session and needs
# to be supplied on each request. Useful if you are using the token as API token.
# config.stateless_token = false
# ==> Scopes configuration
# Turn scoped views on. Before rendering "sessions/new", it will first check for
# "users/sessions/new". It's turned off by default because it's slower if you

11
config/locales/devise.en.yml

@ -35,14 +35,9 @@ en:
send_paranoid_instructions: 'If your e-mail exists on our database, you will receive an email with instructions about how to confirm your account in a few minutes.'
confirmed: 'Your account was successfully confirmed. You are now signed in.'
registrations:
signed_up: 'Welcome! You have signed up successfully.'
inactive_signed_up: 'You have signed up successfully. However, we could not sign you in because your account is %{reason}.'
updated: 'You updated your account successfully.'
destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.'
reasons:
inactive: 'inactive'
unconfirmed: 'unconfirmed'
locked: 'locked'
signed_up_but_unconfirmed: 'A message with a confirmation link has been sent to your email address. Please open the link to activate your account.'
signed_up_but_inactive: 'You have signed up successfully. However, we could not sign you in because your account is not yet activated.'
signed_up_but_locked: 'You have signed up successfully. However, we could not sign you in because your account is locked.'
unlocks:
send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.'
unlocked: 'Your account was successfully unlocked. You are now signed in.'

47
db/migrate/20110917082609_devise_create_users.rb

@ -1,15 +1,44 @@
class DeviseCreateUsers < ActiveRecord::Migration
def self.up
create_table(:users) do |t|
t.database_authenticatable :null => false
t.recoverable
t.rememberable
t.trackable
t.confirmable
t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both
# t.encryptable
# t.token_authenticatable
## Database authenticatable
t.string :email, :null => false, :default => ""
t.string :encrypted_password, :null => false, :default => ""
## Recoverable
t.string :reset_password_token
t.datetime :reset_password_sent_at
## Rememberable
t.datetime :remember_created_at
## Trackable
t.integer :sign_in_count, :default => 0
t.datetime :current_sign_in_at
t.datetime :last_sign_in_at
t.string :current_sign_in_ip
t.string :last_sign_in_ip
## Confirmable
t.string :confirmation_token
t.datetime :confirmed_at
t.datetime :confirmation_sent_at
t.string :unconfirmed_email # Only if using reconfirmable
## Lockable
t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts
t.string :unlock_token # Only if unlock strategy is :email or :both
t.datetime :locked_at
## Encryptable
# t.string :password_salt
# Token authenticatable
# t.string :authentication_token
## Invitable
# t.string :invitation_token
t.timestamps

2
db/samples.rb

@ -1,6 +1,8 @@
unless Object.const_defined?('FactoryGirl')
require 'factory_girl'
require 'faker'
require Rails.root.join('spec', 'factories.rb')
end
# more sample users
users = [User.find_by_email('user@entrydns.net')]

Loading…
Cancel
Save