-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6575d33
commit f7b7a1e
Showing
10 changed files
with
110 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class ConfirmationsController < ApplicationController | ||
def show | ||
user = User.find_by(confirmation_token: params[:token]) | ||
|
||
if user.present? | ||
user.confirm! | ||
redirect_to user, notice: I18n.t('confirmations.success') | ||
else | ||
redirect_to root_path, notice: I18n.t('confirmations.unsuccess') | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
class Signup < ActionMailer::Base | ||
default from: 'no-reply@colcho.net' | ||
|
||
def confirm_email(user) | ||
@user = user | ||
|
||
@confirmation_link = confirmation_url({ | ||
token: @user.confirmation_token | ||
}) | ||
|
||
mail({ | ||
to: user.email, | ||
bcc: ['sign ups <signups@colcho.net>'], | ||
subject: I18n.t('signup.confirm_email.subject') | ||
}) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<h1><%= t '.title' %> </h1> | ||
|
||
<p> | ||
<%= t '.body', full_name: @user.full_name %> | ||
</p> | ||
<p> | ||
<%= t '.confirm_link_html',link: link_to(@confirmation_link, @confirmation_link) %> | ||
</p> | ||
<p> | ||
<%= t '.thanks_html', link: link_to('Colcho.net', root_url) %> | ||
</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<%= t '.title' %> | ||
|
||
%= t '.body', full_name: @user.full_name %> | ||
<%= t '.confirm_link_html', link: @confirmation_link %> | ||
<%= t '.thanks_html', link: root_url %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
db/migrate/20140523221343_add_confirmation_fields_to_users.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class AddConfirmationFieldsToUsers < ActiveRecord::Migration | ||
def change | ||
add_column :users, :confirmed_at, :datetime | ||
add_column :users, :confirmation_token, :string | ||
end | ||
|
||
#change_table :users do |t| | ||
# t.datetime :confirmed_at | ||
# t.string :confirmation_token | ||
#end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters