[refs #128] Add email confirmation on email change. Remove email confirmation after registration.
This commit is contained in:
parent
8b31c6373f
commit
f33ef75666
|
@ -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
|
||||
|
|
|
@ -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' }
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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?
|
||||
|
|
Loading…
Reference in New Issue