diff options
| -rw-r--r-- | Gemfile | 2 | ||||
| -rw-r--r-- | Gemfile.lock | 4 | ||||
| -rw-r--r-- | app/controllers/subscriptions_controller.rb | 2 | ||||
| -rw-r--r-- | app/models/subscription.rb | 6 | ||||
| -rw-r--r-- | app/models/user.rb | 4 | ||||
| -rw-r--r-- | app/views/users/edit.html.erb | 1 |
6 files changed, 9 insertions, 10 deletions
@@ -26,7 +26,7 @@ gem "map_layers", "0.0.4" gem "georuby-ext", "0.0.2" # User interface -gem 'user_interface', "0.0.2" +gem 'user_interface', "0.0.3" gem 'gravatar_image_tag' gem 'calendar_helper', "0.2.5" gem 'cocoon', "1.1.2" diff --git a/Gemfile.lock b/Gemfile.lock index 85743a6ad..7673f4495 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -301,7 +301,7 @@ GEM uglifier (1.2.7) execjs (>= 0.3.0) multi_json (~> 1.3) - user_interface (0.0.2) + user_interface (0.0.3) rails (> 3.1.0) warbler (1.3.6) jruby-jars (>= 1.4.0) @@ -368,6 +368,6 @@ DEPENDENCIES therubyracer (~> 0.10.2) therubyrhino uglifier (>= 1.0.3) - user_interface (= 0.0.2) + user_interface (= 0.0.3) warbler will_paginate (~> 3.0) 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" %> |
