diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index c4bf6b275..2c7e83021 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -16,11 +16,20 @@ class UsersController < ApplicationController end def update + send_confirmation = false + if params[:user][:email] != @user.email + send_confirmation = true + end if @user.update_without_password(params[:user]) if @user.avatar && params[:delete_avatar] == '1' @user.avatar = nil @user.save end + if send_confirmation + @user.confirmed_at = nil + @user.confirmation_sent_at = nil + @user.send_confirmation_instructions + end flash[:notice] = t('flash.user.saved') redirect_to edit_profile_path else diff --git a/config/environments/development.rb b/config/environments/development.rb index 2e44f95a4..c96fe9381 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -16,6 +16,8 @@ Rosa::Application.configure do # Don't care if the mailer can't send config.action_mailer.raise_delivery_errors = false + #config.action_mailer.raise_delivery_errors = true + #config.action_mailer.perform_deliveries = true config.action_mailer.delivery_method = :smtp # :letter_opener config.action_mailer.smtp_settings = { :host => "localhost", :port => 1025 } config.action_mailer.default_url_options = { :host => 'localhost:3000' } diff --git a/db/schema.rb b/db/schema.rb index cb386ec97..fe45f84a7 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,4 +1,4 @@ -# -*- encoding : utf-8 -*- +# encoding: UTF-8 # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. diff --git a/lib/preregistration/devise/preregistration.rb b/lib/preregistration/devise/preregistration.rb index 8b32ffa0c..5b07c5d88 100644 --- a/lib/preregistration/devise/preregistration.rb +++ b/lib/preregistration/devise/preregistration.rb @@ -34,6 +34,7 @@ module Preregistration redirect_to new_register_request_path and return unless req and resource.email == req.email @invitation_token = req.token + resource.skip_confirmation! if resource.save if resource.active_for_authentication? set_flash_message :notice, :signed_up if is_navigational_format?