Added devise migartions

This commit is contained in:
Priit Tark 2015-05-20 13:48:16 +03:00
parent 61cbc38a11
commit db4727b8f7
4 changed files with 38 additions and 15 deletions

View file

@ -8,6 +8,8 @@ class AdminUser < User
ROLES = %w(user customer_service admin)
devise :database_authenticatable, :rememberable, :trackable, :validatable, :lockable
def to_s
username
end

View file

@ -9,7 +9,7 @@
= err
%br
.row
.col-md-6
.col-md-8
.panel.panel-default
.panel-heading
%h3.panel-title= t(:general)
@ -18,21 +18,12 @@
%dt= t(:username)
%dd= @admin_user.username
%dt= t(:password)
%dd= @admin_user.password
%dt= t(:email)
%dd= @admin_user.email
%dt= t(:identity_code)
%dd= @admin_user.identity_code
.col-md-6
.panel.panel-default
.panel-heading
%h3.panel-title= t(:address)
.panel-body
%dl.dl-horizontal
%dt= t(:email)
%dd= @admin_user.email
%dt= t(:role)
- if @admin_user.roles
%dd= t(@admin_user.roles.first)

View file

@ -0,0 +1,8 @@
class AddDeviseAttributes < ActiveRecord::Migration
def change
add_column :users, :encrypted_password, :string, null: true, default: ""
add_column :users, :remember_created_at, :datetime, null: true
add_column :users, :failed_attempts, :integer, default: 0, null: false
add_column :users, :locked_at, :datetime, null: true
end
end

View file

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20150519102521) do
ActiveRecord::Schema.define(version: 20150519144118) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -840,6 +840,24 @@ ActiveRecord::Schema.define(version: 20150519102521) do
add_index "nameservers", ["domain_id"], name: "index_nameservers_on_domain_id", using: :btree
create_table "people", force: :cascade do |t|
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.inet "current_sign_in_ip"
t.inet "last_sign_in_ip"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "people", ["email"], name: "index_people_on_email", unique: true, using: :btree
add_index "people", ["reset_password_token"], name: "index_people_on_reset_password_token", unique: true, using: :btree
create_table "registrant_verifications", force: :cascade do |t|
t.string "domain_name"
t.string "verification_token"
@ -907,13 +925,13 @@ ActiveRecord::Schema.define(version: 20150519102521) do
t.datetime "created_at"
t.datetime "updated_at"
t.string "email"
t.integer "sign_in_count", default: 0, null: false
t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.inet "current_sign_in_ip"
t.inet "last_sign_in_ip"
t.string "identity_code"
t.string "roles", array: true
t.string "roles", array: true
t.string "creator_str"
t.string "updator_str"
t.string "country_code"
@ -923,6 +941,10 @@ ActiveRecord::Schema.define(version: 20150519102521) do
t.text "crt"
t.string "type"
t.string "registrant_ident"
t.string "encrypted_password", default: ""
t.datetime "remember_created_at"
t.integer "failed_attempts", default: 0, null: false
t.datetime "locked_at"
end
add_index "users", ["identity_code"], name: "index_users_on_identity_code", using: :btree