This commit is contained in:
sw 2015-01-21 09:19:05 +08:00
commit 4caf6ab5f7
7 changed files with 41 additions and 3 deletions

View File

@ -18,6 +18,7 @@ gem "builder", "3.0.0"
gem 'acts-as-taggable-on', '2.4.1' gem 'acts-as-taggable-on', '2.4.1'
gem 'spreadsheet' gem 'spreadsheet'
gem 'ruby-ole' gem 'ruby-ole'
gem 'email_verifier'
group :development do group :development do
gem 'better_errors', path: 'lib/better_errors' gem 'better_errors', path: 'lib/better_errors'
@ -51,7 +52,8 @@ group :development, :test do
gem 'ruby-prof', '~> 0.15.1' unless RUBY_PLATFORM =~ /w32/ gem 'ruby-prof', '~> 0.15.1' unless RUBY_PLATFORM =~ /w32/
gem 'pry' gem 'pry'
gem 'pry-nav' gem 'pry-nav'
gem 'rspec-rails' , '2.13.1'
gem 'guard-rspec','2.5.0'
end end

View File

@ -345,7 +345,10 @@ class AccountController < ApplicationController
if user.save and token.save if user.save and token.save
UserStatus.create(:user_id => user.id, :changsets_count => 0, :watchers_count => 0) UserStatus.create(:user_id => user.id, :changsets_count => 0, :watchers_count => 0)
Mailer.register(token).deliver Mailer.register(token).deliver
flash[:notice] = l(:notice_account_register_done) flash[:notice] = l(:notice_account_register_done)
render action: 'email_valid', locals: {:mail => user.mail} render action: 'email_valid', locals: {:mail => user.mail}
else else
yield if block_given? yield if block_given?

View File

@ -188,7 +188,7 @@ class User < Principal
validates_confirmation_of :password, :allow_nil => true validates_confirmation_of :password, :allow_nil => true
validates_inclusion_of :mail_notification, :in => MAIL_NOTIFICATION_OPTIONS.collect(&:first), :allow_blank => true validates_inclusion_of :mail_notification, :in => MAIL_NOTIFICATION_OPTIONS.collect(&:first), :allow_blank => true
validate :validate_password_length validate :validate_password_length
validates_email_realness_of :mail
before_create :set_mail_notification before_create :set_mail_notification
before_save :update_hashed_password before_save :update_hashed_password
before_destroy :remove_references_before_destroy before_destroy :remove_references_before_destroy

View File

@ -16,6 +16,11 @@ module RedmineApp
# Application configuration should go into files in config/initializers # Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded. # -- all .rb files in that directory are automatically loaded.
# verifier if email is real
EmailVerifier.config do |config|
config.verifier_email = "lizanle521@126.com"
end
# Custom directories with classes and modules you want to be autoloadable. # Custom directories with classes and modules you want to be autoloadable.
config.autoload_paths += %W(#{config.root}/lib) config.autoload_paths += %W(#{config.root}/lib)

View File

@ -13,7 +13,7 @@ RedmineApp::Application.configure do
config.action_controller.perform_caching = false config.action_controller.perform_caching = false
# Don't care if the mailer can't send # Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = false config.action_mailer.raise_delivery_errors = true
config.active_support.deprecation = :log config.active_support.deprecation = :log
end end

View File

@ -71,6 +71,14 @@ en:
one: "almost 1 year" one: "almost 1 year"
other: "almost %{count} years" other: "almost %{count} years"
errors:
messages:
email_verifier:
email_not_real: must point to a real mail account
out_of_mail_server: appears to point to dead mail server
no_mail_server: appears to point to domain which doesn't handle e-mail
failure: could not be checked if is real
exception: could not be sent
number: number:
format: format:
separator: "." separator: "."
@ -130,6 +138,9 @@ en:
circular_dependency: "This relation would create a circular dependency" circular_dependency: "This relation would create a circular dependency"
cant_link_an_issue_with_a_descendant: "An issue cannot be linked to one of its subtasks" cant_link_an_issue_with_a_descendant: "An issue cannot be linked to one of its subtasks"
actionview_instancetag_blank_option: Please select actionview_instancetag_blank_option: Please select
attachment_all: "All" attachment_all: "All"

View File

@ -2,6 +2,10 @@
# Chinese (China) translations for Ruby on Rails # Chinese (China) translations for Ruby on Rails
# by tsechingho (http://github.com/tsechingho) # by tsechingho (http://github.com/tsechingho)
zh: zh:
# Text direction: Left-to-Right (ltr) or Right-to-Left (rtl) # Text direction: Left-to-Right (ltr) or Right-to-Left (rtl)
direction: ltr direction: ltr
jquery: jquery:
@ -30,6 +34,17 @@ zh:
- :month - :month
- :day - :day
errors:
messages:
email_verifier:
email_not_real: 必须指定一个真实的邮箱地址
out_of_mail_server: 指向了一个已停用的邮箱服务器
no_mail_server: 域名地址没有邮件功能
failure: 邮箱地址不能被验证
exception: 邮箱不能发送成功
time: time:
formats: formats:
default: "%Y年%b%d日 %A %H:%M:%S" default: "%Y年%b%d日 %A %H:%M:%S"
@ -138,6 +153,8 @@ zh:
circular_dependency: "此关联将导致循环依赖" circular_dependency: "此关联将导致循环依赖"
cant_link_an_issue_with_a_descendant: "问题不能关联到它的子任务" cant_link_an_issue_with_a_descendant: "问题不能关联到它的子任务"
actionview_instancetag_blank_option: 请选择 actionview_instancetag_blank_option: 请选择
attachment_all: "全部" attachment_all: "全部"