Commit 7e93da3f authored by Eugen Rochko's avatar Eugen Rochko

Removing grape and adding devise

parent 3b4e04dc
......@@ -16,10 +16,6 @@ gem 'pg'
gem 'dotenv-rails'
gem 'font-awesome-sass'
gem 'grape'
gem 'grape-route-helpers'
gem 'grape-entity'
gem 'hashie-forbidden_attributes'
gem 'paranoia', '~> 2.0'
gem 'paperclip', '~> 4.3'
gem 'backport_new_renderer'
......@@ -29,12 +25,12 @@ gem 'addressable'
gem 'nokogiri'
gem 'ostatus2'
gem 'goldfinger'
gem 'devise'
group :development, :test do
gem 'rspec-rails'
gem 'quiet_assets'
gem 'pry-rails'
gem 'nyan-cat-formatter'
gem 'fuubar'
gem 'fabrication'
end
......
......@@ -39,12 +39,9 @@ GEM
addressable (2.4.0)
arel (6.0.3)
ast (2.2.0)
axiom-types (0.1.1)
descendants_tracker (~> 0.0.4)
ice_nine (~> 0.11.0)
thread_safe (~> 0.3, >= 0.3.1)
backport_new_renderer (1.0.0)
rails
bcrypt (3.1.10)
better_errors (2.1.1)
coderay (>= 1.0.0)
erubis (>= 2.6.6)
......@@ -57,8 +54,6 @@ GEM
cocaine (0.5.8)
climate_control (>= 0.0.3, < 1.0)
coderay (1.1.1)
coercible (1.0.0)
descendants_tracker (~> 0.0.1)
coffee-rails (4.1.1)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.1.x)
......@@ -70,8 +65,13 @@ GEM
crack (0.4.3)
safe_yaml (~> 1.0.0)
debug_inspector (0.0.2)
descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1)
devise (3.5.6)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 3.2.6, < 5)
responders
thread_safe (~> 0.1)
warden (~> 1.2.3)
diff-lcs (1.2.5)
docile (1.1.5)
domain_name (0.5.20160128)
......@@ -80,7 +80,6 @@ GEM
dotenv-rails (2.1.0)
dotenv (= 2.1.0)
railties (>= 4.0, < 5.1)
equalizer (0.0.11)
erubis (2.7.0)
execjs (2.6.0)
fabrication (2.14.1)
......@@ -95,23 +94,6 @@ GEM
addressable (~> 2.4)
http (~> 1.0)
nokogiri (~> 1.6)
grape (0.14.0)
activesupport
builder
hashie (>= 2.1.0)
multi_json (>= 1.3.2)
multi_xml (>= 0.5.2)
rack (>= 1.3.0)
rack-accept
rack-mount
virtus (>= 1.0.0)
grape-entity (0.5.0)
activesupport
multi_json (>= 1.3.2)
grape-route-helpers (1.2.1)
activesupport
grape
rake
haml (4.0.7)
tilt
haml-rails (0.9.0)
......@@ -121,9 +103,6 @@ GEM
html2haml (>= 1.0.1)
railties (>= 4.0.1)
hashdiff (0.3.0)
hashie (3.4.3)
hashie-forbidden_attributes (0.1.1)
hashie (>= 3.0)
html2haml (2.0.0)
erubis (~> 2.7.0)
haml (~> 4.0.0)
......@@ -139,7 +118,6 @@ GEM
http-form_data (1.0.1)
http_parser.rb (0.6.0)
i18n (0.7.0)
ice_nine (0.11.2)
jbuilder (2.4.1)
activesupport (>= 3.0.0, < 5.1)
multi_json (~> 1.2)
......@@ -159,11 +137,9 @@ GEM
mini_portile2 (2.0.0)
minitest (5.8.4)
multi_json (1.11.2)
multi_xml (0.5.5)
nokogiri (1.6.7.2)
mini_portile2 (~> 2.0.0.rc2)
nyan-cat-formatter (0.11)
rspec (>= 2.99, >= 2.14.2, < 4)
orm_adapter (0.5.0)
ostatus2 (0.1.1)
addressable (~> 2.4)
http (~> 1.0)
......@@ -190,10 +166,6 @@ GEM
quiet_assets (1.1.0)
railties (>= 3.1, < 5.0)
rack (1.6.4)
rack-accept (0.4.5)
rack (>= 0.4)
rack-mount (0.8.3)
rack (>= 1.0.0)
rack-test (0.6.3)
rack (>= 1.0)
rails (4.2.5.1)
......@@ -230,6 +202,8 @@ GEM
rdoc (4.2.2)
json (~> 1.4)
ref (2.0.0)
responders (2.1.1)
railties (>= 4.2.0, < 5.1)
rspec (3.4.0)
rspec-core (~> 3.4.0)
rspec-expectations (~> 3.4.0)
......@@ -302,11 +276,8 @@ GEM
unf_ext
unf_ext (0.0.7.2)
unicode-display_width (0.3.1)
virtus (1.0.5)
axiom-types (~> 0.1)
coercible (~> 1.0)
descendants_tracker (~> 0.0, >= 0.0.3)
equalizer (~> 0.0, >= 0.0.9)
warden (1.2.6)
rack (>= 1.0)
web-console (2.3.0)
activemodel (>= 4.0)
binding_of_caller (>= 0.7.2)
......@@ -326,21 +297,17 @@ DEPENDENCIES
better_errors
binding_of_caller
coffee-rails (~> 4.1.0)
devise
dotenv-rails
fabrication
font-awesome-sass
fuubar
goldfinger
grape
grape-entity
grape-route-helpers
haml-rails
hashie-forbidden_attributes
http
jbuilder (~> 2.0)
jquery-rails
nokogiri
nyan-cat-formatter
ostatus2
paperclip (~> 4.3)
paranoia (~> 2.0)
......
module RoutingHelper
extend ActiveSupport::Concern
include Rails.application.routes.url_helpers
include GrapeRouteHelpers::NamedRouteMatcher
include ActionView::Helpers::AssetUrlHelper
included do
......
class User < ActiveRecord::Base
devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable
belongs_to :account, inverse_of: :user
validates :account, presence: true
end
This diff is collapsed.
# Additional translations at https://github.com/plataformatec/devise/wiki/I18n
en:
devise:
confirmations:
confirmed: "Your email address has been successfully confirmed."
send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes."
send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes."
failure:
already_authenticated: "You are already signed in."
inactive: "Your account is not activated yet."
invalid: "Invalid %{authentication_keys} or password."
locked: "Your account is locked."
last_attempt: "You have one more attempt before your account is locked."
not_found_in_database: "Invalid %{authentication_keys} or password."
timeout: "Your session expired. Please sign in again to continue."
unauthenticated: "You need to sign in or sign up before continuing."
unconfirmed: "You have to confirm your email address before continuing."
mailer:
confirmation_instructions:
subject: "Confirmation instructions"
reset_password_instructions:
subject: "Reset password instructions"
unlock_instructions:
subject: "Unlock instructions"
password_change:
subject: "Password Changed"
omniauth_callbacks:
failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
success: "Successfully authenticated from %{kind} account."
passwords:
no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
updated: "Your password has been changed successfully. You are now signed in."
updated_not_active: "Your password has been changed successfully."
registrations:
destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
signed_up: "Welcome! You have signed up successfully."
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."
signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account."
update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirm link to confirm your new email address."
updated: "Your account has been updated successfully."
sessions:
signed_in: "Signed in successfully."
signed_out: "Signed out successfully."
already_signed_out: "Signed out successfully."
unlocks:
send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
unlocked: "Your account has been unlocked successfully. Please sign in to continue."
errors:
messages:
already_confirmed: "was already confirmed, please try signing in"
confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
expired: "has expired, please request a new one"
not_found: "not found"
not_locked: "was not locked"
not_saved:
one: "1 error prohibited this %{resource} from being saved:"
other: "%{count} errors prohibited this %{resource} from being saved:"
......@@ -2,6 +2,8 @@ Rails.application.routes.draw do
get '.well-known/host-meta', to: 'xrd#host_meta', as: :host_meta
get '.well-known/webfinger', to: 'xrd#webfinger', as: :webfinger
devise_for :users, path: 'auth'
resources :accounts, path: 'users', only: [:show], param: :username do
resources :stream_entries, path: 'updates', only: [:show]
end
......
class AddDeviseToUsers < ActiveRecord::Migration
def self.up
change_table(:users) do |t|
## Database authenticatable
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, 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
end
add_index :users, :reset_password_token, unique: true
end
def self.down
remove_index :users, :reset_password_token
remove_column :users, :encrypted_password
remove_column :users, :reset_password_token
remove_column :users, :reset_password_sent_at
remove_column :users, :remember_created_at
remove_column :users, :sign_in_count
remove_column :users, :current_sign_in_at
remove_column :users, :current_sign_in_ip
remove_column :users, :last_sign_in_at
remove_column :users, :last_sign_in_ip
end
end
......@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20160227230233) do
ActiveRecord::Schema.define(version: 20160305115639) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
......@@ -89,12 +89,22 @@ ActiveRecord::Schema.define(version: 20160227230233) do
end
create_table "users", force: :cascade do |t|
t.string "email", default: "", null: false
t.integer "account_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "email", default: "", null: false
t.integer "account_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", 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"
end
add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment