Commit cf417328
Changed files (5)
app
config
spec
app/helpers/devise_helper.rb
@@ -1,25 +0,0 @@
-module DeviseHelper
- def devise_error_messages!
- return "" if resource.errors.empty?
-
- messages = resource.errors.full_messages.map { |msg| content_tag(:li, msg) }.join
- sentence = I18n.t("errors.messages.not_saved",
- :count => resource.errors.count,
- :resource => resource.class.model_name.human.downcase)
-
- html = <<-HTML
- <div id="error_explanation">
- <h2>#{sentence}</h2>
- <ul>#{messages}</ul>
- </div>
- HTML
-
- html.html_safe
- end
- def devise_flash
- if controller.devise_controller? && resource.errors.any?
- flash.now[:error] = flash[:error].to_a.concat(resource.errors.full_messages)
- flash.now[:error].uniq!
- end
- end
-end
app/models/user.rb
@@ -95,7 +95,7 @@ class User < ActiveRecord::Base
user = User.find_by(email: username)
return false if user.nil?
if user.valid_password?(password)
- UserSession.create!(user: self)
+ UserSession.create!(user: user)
else
false
end
app/views/layouts/_messages.html.erb
@@ -1,4 +1,3 @@
-<% devise_flash -%>
<% if(flash.any?) -%>
<div class="row-fluid">
<div class="span12">
config/routes.rb
@@ -52,6 +52,8 @@ Cake::Application.routes.draw do
# /users
#devise_for :users, :controllers => {:registrations => 'registrations'}, :path => '', :path_names => { :sign_in => "signin", :sign_out => "signout", :sign_up => "register" }
+ resources :passwords, only: [:new]
+ resource :registration
# sitemap
get "/sitemap.xml", to: "sitemap#index", defaults: { format: :xml }
spec/spec_helper.rb
@@ -24,6 +24,7 @@ require "factory_girl_rails"
#
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
+ config.backtrace_exclusion_patterns << /gems/
# The settings below are suggested to provide a good initial experience
# with RSpec, but feel free to customize to your heart's content.
# These two settings work together to allow you to limit a spec run