aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorMarc Florisson2013-06-24 16:54:58 +0200
committerMarc Florisson2013-06-24 16:54:58 +0200
commitd6e1fb95a05bcbd1d7c3bbc7133da06001f6af6b (patch)
treea310b5c545ea9dd5c3ea377814372380d99796f1 /app
parentc868b0c7996705a96dc70de2d3730c80625df197 (diff)
downloadchouette-core-d6e1fb95a05bcbd1d7c3bbc7133da06001f6af6b.tar.bz2
fix subscription and user edit page
Diffstat (limited to 'app')
-rw-r--r--app/controllers/subscriptions_controller.rb2
-rw-r--r--app/models/subscription.rb6
-rw-r--r--app/models/user.rb4
-rw-r--r--app/views/users/edit.html.erb1
4 files changed, 6 insertions, 7 deletions
diff --git a/app/controllers/subscriptions_controller.rb b/app/controllers/subscriptions_controller.rb
index f16370a00..a1dca5a5d 100644
--- a/app/controllers/subscriptions_controller.rb
+++ b/app/controllers/subscriptions_controller.rb
@@ -2,7 +2,7 @@ class SubscriptionsController < InheritedResources::Base
skip_filter :authenticate_user!
def create
- create! do |success|
+ create! do |success, failure|
success.html do
sign_in resource.user
redirect_to referentials_path
diff --git a/app/models/subscription.rb b/app/models/subscription.rb
index c0d42732b..7b4e8c099 100644
--- a/app/models/subscription.rb
+++ b/app/models/subscription.rb
@@ -5,11 +5,6 @@ class Subscription
attr_accessor :organisation_name, :user_name, :email, :password, :password_confirmation
- validates_presence_of :organisation_name
- validates_presence_of :user_name
- validates_presence_of :email
- validates_presence_of :password
- validates_presence_of :password_confirmation
def initialize(attributes = {})
attributes.each do |name, value|
@@ -36,6 +31,7 @@ class Subscription
unless user.valid?
self.errors.add( :user_name, user.errors[:name]) if user.errors[:name]
self.errors.add( :password, user.errors[:password]) if user.errors[:password]
+ self.errors.add( :password_confirmation, user.errors[:password_confirmation]) if user.errors[:password_confirmation]
self.errors.add( :email, user.errors[:email]) if user.errors[:email]
end
self.errors.empty?
diff --git a/app/models/user.rb b/app/models/user.rb
index f88fbfd41..1b9ec7416 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -6,12 +6,14 @@ class User < ActiveRecord::Base
:confirmable, :invitable
# Setup accessible (or protected) attributes for your model
- attr_accessible :email, :password, :password_confirmation, :remember_me, :name
+ attr_accessible :email, :password, :current_password, :password_confirmation, :remember_me, :name
belongs_to :organisation
validates_presence_of :email
+ validates_presence_of :name
validates_presence_of :password
+ validates_presence_of :password_confirmation
before_validation(:on => :create) do
self.password ||= Devise.friendly_token.first(6)
diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb
index 89d01b648..38a9ff78b 100644
--- a/app/views/users/edit.html.erb
+++ b/app/views/users/edit.html.erb
@@ -1,3 +1,4 @@
<%= title_tag t('.title', :user => @user.email) %>
+<p>iouoiu</p>
<%= render "form" %>