Merge pull request #64 from turniere/ticket/TURNIERE-235

Verify E-Mail Adress of account creator
This commit is contained in:
Daniel Schädler 2019-06-18 12:59:55 +02:00 committed by GitHub
commit f71179ee8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 74 additions and 8 deletions

View File

@ -40,6 +40,8 @@ gem 'interactor-rails'
gem 'active_model_serializers' gem 'active_model_serializers'
gem 'mailgun-ruby'
group :development, :test do group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console # Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: %i[mri mingw x64_mingw] gem 'byebug', platforms: %i[mri mingw x64_mingw]

View File

@ -76,6 +76,8 @@ GEM
rails (>= 4.2.0, < 6) rails (>= 4.2.0, < 6)
diff-lcs (1.3) diff-lcs (1.3)
docile (1.3.1) docile (1.3.1)
domain_name (0.5.20180417)
unf (>= 0.0.5, < 1.0.0)
erubi (1.8.0) erubi (1.8.0)
factory_bot (5.0.2) factory_bot (5.0.2)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
@ -88,6 +90,8 @@ GEM
globalid (0.4.2) globalid (0.4.2)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
htmlentities (4.3.4) htmlentities (4.3.4)
http-cookie (1.0.3)
domain_name (~> 0.5)
i18n (1.6.0) i18n (1.6.0)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
interactor (3.1.1) interactor (3.1.1)
@ -107,14 +111,20 @@ GEM
nokogiri (>= 1.5.9) nokogiri (>= 1.5.9)
mail (2.7.1) mail (2.7.1)
mini_mime (>= 0.1.1) mini_mime (>= 0.1.1)
mailgun-ruby (1.1.11)
rest-client (~> 2.0.2)
marcel (0.3.3) marcel (0.3.3)
mimemagic (~> 0.3.2) mimemagic (~> 0.3.2)
method_source (0.9.2) method_source (0.9.2)
mime-types (3.2.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2019.0331)
mimemagic (0.3.3) mimemagic (0.3.3)
mini_mime (1.0.1) mini_mime (1.0.1)
mini_portile2 (2.4.0) mini_portile2 (2.4.0)
minitest (5.11.3) minitest (5.11.3)
msgpack (1.2.9) msgpack (1.2.9)
netrc (0.11.0)
nio4r (2.3.1) nio4r (2.3.1)
nokogiri (1.10.2) nokogiri (1.10.2)
mini_portile2 (~> 2.4.0) mini_portile2 (~> 2.4.0)
@ -162,6 +172,10 @@ GEM
responders (2.4.1) responders (2.4.1)
actionpack (>= 4.2.0, < 6.0) actionpack (>= 4.2.0, < 6.0)
railties (>= 4.2.0, < 6.0) railties (>= 4.2.0, < 6.0)
rest-client (2.0.2)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
reverse_markdown (1.1.0) reverse_markdown (1.1.0)
nokogiri nokogiri
rspec-core (3.8.0) rspec-core (3.8.0)
@ -230,6 +244,9 @@ GEM
tins (1.20.2) tins (1.20.2)
tzinfo (1.2.5) tzinfo (1.2.5)
thread_safe (~> 0.1) thread_safe (~> 0.1)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.6)
unicode-display_width (1.5.0) unicode-display_width (1.5.0)
warden (1.2.8) warden (1.2.8)
rack (>= 2.0.6) rack (>= 2.0.6)
@ -253,6 +270,7 @@ DEPENDENCIES
interactor interactor
interactor-rails interactor-rails
listen (>= 3.0.5, < 3.2) listen (>= 3.0.5, < 3.2)
mailgun-ruby
pg pg
puma (~> 3.11) puma (~> 3.11)
rack-cors rack-cors

View File

@ -3,7 +3,7 @@
class User < ApplicationRecord class User < ApplicationRecord
extend Devise::Models extend Devise::Models
devise :database_authenticatable, :registerable, devise :database_authenticatable, :registerable, :confirmable,
:recoverable, :rememberable, :trackable, :validatable :recoverable, :rememberable, :trackable, :validatable
include DeviseTokenAuth::Concerns::User include DeviseTokenAuth::Concerns::User

View File

@ -0,0 +1,5 @@
<p>Welcome <%= @email %>!</p>
<p>You can confirm your account email through the link below:</p>
<p><%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %></p>

View File

@ -0,0 +1,7 @@
<p>Hello <%= @email %>!</p>
<% if @resource.try(:unconfirmed_email?) %>
<p>We're contacting you to notify you that your email is being changed to <%= @resource.unconfirmed_email %>.</p>
<% else %>
<p>We're contacting you to notify you that your email has been changed to <%= @resource.email %>.</p>
<% end %>

View File

@ -0,0 +1,3 @@
<p>Hello <%= @resource.email %>!</p>
<p>We're contacting you to notify you that your password has been changed.</p>

View File

@ -0,0 +1,8 @@
<p>Hello <%= @resource.email %>!</p>
<p>Someone has requested a link to change your password. You can do this through the link below.</p>
<p><%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %></p>
<p>If you didn't request this, please ignore this email.</p>
<p>Your password won't change until you access the link above and create a new one.</p>

View File

@ -0,0 +1,7 @@
<p>Hello <%= @resource.email %>!</p>
<p>Your account has been locked due to an excessive number of unsuccessful sign in attempts.</p>
<p>Click the link below to unlock your account:</p>
<p><%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %></p>

View File

@ -40,5 +40,11 @@ module TurniereBackend
resource '*', headers: :any, methods: :any, expose: ['access-token', 'client', 'expiry', 'uid'] resource '*', headers: :any, methods: :any, expose: ['access-token', 'client', 'expiry', 'uid']
end end
end end
# Mail
config.action_mailer.default_url_options = { host: 'turnie.re' }
config.action_mailer.default_options = {
from: 'noreply@turnie.re'
}
end end
end end

View File

@ -1 +1 @@
dCVJGOYsmgcPz9jtSayZvIPAReIg2LIeScmbZ66S3PHhRj32F3vhQJLpARU26RISOCc8cFxvVcZb1H/Lhmj9iq+5/+5471OB04U74F7vbXIpgwlC+4CYD99hDOw/i9GokwfT/E/nqW1tBBMIm17QC8EwrJgIZlZCxE6C/3DUx+sAcupQafb9NAFqRffoL9KQj7X7CyJ3d7GCQUX1cS+x6/sLtfqxvEN5vWn702yMg5Ff5TdGUfHlaLCfA9POk1UEf36kwcqhK78XLfGgq+W1cTJCvgOjdxk2sOdo1gRVElpFH4DJ1l/VG1/C7AO33QPZNWH0TlWwje9FewHhr3Vq3xhfqmraChfPcRiHoFOS4rPFddeMtWq2oWZMj+DfhjJVW9WccTOJO7wWUH9HOdNHFEfQ6P1vKVq3oyXcWOVi248Me1YXEqfb1X1Lt/QuTbF0tEwfUThKmlCvqi/C0To4gf8WmZaU0OrJZzdozA9uL+99aZd6VduCkVzE9/OSZ5RLlPrDThitoCDTSFfeTMIwLlF3siGsVm9oc1GFex8zIx0FsLO5AIBSEa0kx20/2jUXNw==--HHZlzHqK+9w+/284--yCLnfdWp8Wvgf3buUq4RYg== lZTlGrYwVpMhsFEPbuQuWM50gk6t6SIFng3hUJ+X5JBbhEKv0fBrbwIw7//jGY/S00XTYPMf4H7nm7z2WyoLWWTUDIGoEZUKFPefkfytmTv6Com236i7z7/w6PkiLb9+16ixrTCKxcBeQ7esPctzPjKAeCPrCes8RQCePrOx+gwa1LmEb9JE31U631vVB+BQD1u2mTtlzfiImBC/u3kNJvTdtza9Quld1TUGTiamPQUo+GuHKdPDW6hHL/LdJ5vUcYkU1x+uqd0UeQYYEKBzy+5N7autn4qEVZTuOvxtDGCEq0QKKIDdXHJDThPjtPeO7yY97fPx9oijUMbLrdk+ZkQcS3f0s8iHGbV32AFzcldXasfJEzqQv61nXsaGfPHa944xkt0dG/0Jq25Y+GuZzsgitJ+A3lsAL6xfZ6wsZV1QfnwO6ironECskznRwSgneq83RILRdPy03ye6XQI6ykemmAr5JcOj6t5gRiovF0q+buuMkjDyxIO5YfRTZLGuePFRqR+Zp7kxaG8pGKwSISauPanGqV+27z8GH68hidlqk4NCZ5D9FE2idxF0WXon5BQN3cQmHSUlUsV9ovFt9A2ysmP3wAOH/SX5omOcc7h0fieVp95L34P+m+VPrG/ICTW5PWNmX0SiJwCx4nqtVtCaA9G0HkMkNLuKpg2xBjWzGGQIavXhw9/psFvNmDB/dQ==--HuHh1Wokx17kNpuw--gZGihS+vuQyynRk9ZchTuw==

View File

@ -54,7 +54,10 @@ Rails.application.configure do
config.file_watcher = ActiveSupport::EventedFileUpdateChecker config.file_watcher = ActiveSupport::EventedFileUpdateChecker
# Mail # Mail
config.action_mailer.default_url_options = { host: 'localhost' } config.action_mailer.default_url_options = { host: 'localhost:3000' }
config.action_mailer.delivery_method = :smtp config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = { address: 'localhost', port: 1025 } config.action_mailer.smtp_settings = {
address: 'localhost',
port: 1025
}
end end

View File

@ -53,10 +53,6 @@ Rails.application.configure do
config.action_mailer.perform_caching = false config.action_mailer.perform_caching = false
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found). # the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true config.i18n.fallbacks = true
@ -79,4 +75,13 @@ Rails.application.configure do
# Do not dump schema after migrations. # Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false config.active_record.dump_schema_after_migration = false
# Mail
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default_url_options = { host: 'api01.turnie.re' }
config.action_mailer.delivery_method = :mailgun
config.action_mailer.mailgun_settings = {
api_key: Rails.application.credentials.dig(:mailgun, :api_key),
domain: Rails.application.credentials.dig(:mailgun, :domain)
}
end end

View File

@ -47,4 +47,6 @@ DeviseTokenAuth.setup do |config|
# If, however, you wish to integrate with legacy Devise authentication, you can # If, however, you wish to integrate with legacy Devise authentication, you can
# do so by enabling this flag. NOTE: This feature is highly experimental! # do so by enabling this flag. NOTE: This feature is highly experimental!
# config.enable_standard_devise_support = false # config.enable_standard_devise_support = false
config.default_confirm_success_url = 'https://frontend01.turnie.re'
end end