authlogic_email_token 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 57a2824d5e5150536475eedf6d5307381d851dbd
4
- data.tar.gz: 45b526b5dbf9e00ba96773ac3f1a54b708356b0e
3
+ metadata.gz: 4f3e77624dc5f9e2f5b129cd61a900028dbb7001
4
+ data.tar.gz: 35bdf3ee1f6cd7e54b22aecd88993f87c031094e
5
5
  SHA512:
6
- metadata.gz: f2d3a5f2de18520957d3efe718879c72fa64cb78684f1b71a011f63b0ab56fe95293c3b0e029e03443279704f34e9d9d20f1405330afaa3473646e755f7bebcb
7
- data.tar.gz: dacab199324c87d1c0d7b33c0a2dc971fc5da3dc73bf44a369a7a0dc6680c2ea11457b491eb49a67a3f8c6a26f96cbd1b51f26cab28d0f4056d85c9b2c69d2e6
6
+ metadata.gz: fe41c768348ff31c7c315fca8747a45bee3398fa6118a964bedfb0884e57898937f2abf3d1df8252a2c522b853340a66675aba0e41d594213881943750206fad
7
+ data.tar.gz: e730d51d2451f00a47790d8c4770803135122addb4fa58a2a804ac8bd4f6ddfe174dba052d6a5dc1dc26b0e951f39e17f10ea542fdb17714010f28bb0e572a89
@@ -24,14 +24,16 @@ module Authlogic::ActsAsAuthentic::EmailToken
24
24
  end
25
25
  alias_method :email_token_valid_for=, :email_token_valid_for
26
26
 
27
- # Configures the name of the account activation boolean column. See
27
+ # Configures the name of the account activation boolean column. The default method
28
+ # name is +activate+. See
28
29
  # +Authlogic::ActsAsAuthentic::EmailToken::Confirmation#confirm_email+ for more info.
29
30
  def activation_method(value = nil)
30
31
  rw_config(:activation_method, value, :activate)
31
32
  end
32
33
  alias_method :activation_method=, :activation_method
33
34
 
34
- # Configures the name of the confirmation mailer class.
35
+ # Configures the name of the confirmation mailer class. The default class name is
36
+ # +UserMailer+. See
35
37
  # +Authlogic::ActsAsAuthentic::EmailToken::maybe_deliver_email_confirmation!+
36
38
  # for more info.
37
39
  def confirmation_mailer_class(value = nil)
@@ -39,7 +41,8 @@ module Authlogic::ActsAsAuthentic::EmailToken
39
41
  end
40
42
  alias_method :confirmation_mailer_class=, :confirmation_mailer_class
41
43
 
42
- # Configures the name of the confirmation mailer method.
44
+ # Configures the name of the confirmation mailer method. The default method name is
45
+ # +email_confirmation+. See
43
46
  # +Authlogic::ActsAsAuthentic::EmailToken::maybe_deliver_email_confirmation!+
44
47
  # for more info.
45
48
  def confirmation_mailer_method(value = nil)
@@ -1,8 +1,7 @@
1
- # This module is an optional part of the authlogic_email_token gem. It provides some
2
- # standard logic for confirming email addresses.
1
+ # This module provides some standard logic for confirming email addresses, both upon
2
+ # signup and when an existing user changes her email address.
3
3
  #
4
- # Include this module in your +User+ model and add a +new_email+ column to the +users+
5
- # table:
4
+ # Include this module in your +User+ model.
6
5
  #
7
6
  # add_column :users, :new_email, :string, after: :email
8
7
  #
@@ -94,7 +93,7 @@ module Authlogic::ActsAsAuthentic::EmailToken::Confirmation
94
93
  #
95
94
  # class UsersController < ApplicationController
96
95
  # def create
97
- # @user = User.new user_params
96
+ # @user = User.new new_user_params
98
97
  # if @user.save
99
98
  # @user.maybe_deliver_email_confirmation! self
100
99
  # redirect_to root_url, notice: 'Confirmation email sent.'
@@ -104,7 +103,7 @@ module Authlogic::ActsAsAuthentic::EmailToken::Confirmation
104
103
  # end
105
104
  #
106
105
  # def update
107
- # if current_user.update_attributes user_params
106
+ # if current_user.update_attributes existing_user_params
108
107
  # if current_user.maybe_deliver_email_confirmation! self
109
108
  # redirect_to(edit_user_url, notice: 'Confirmation email sent.'
110
109
  # else
@@ -114,6 +113,17 @@ module Authlogic::ActsAsAuthentic::EmailToken::Confirmation
114
113
  # render action: 'edit'
115
114
  # end
116
115
  # end
116
+ #
117
+ # private
118
+
119
+ def existing_user_params
120
+ params.require(:user).permit(:new_email, :password, :password_confirmation)
121
+ end
122
+
123
+ def new_user_params
124
+ params.require(:user).permit(:email, :password, :password_confirmation)
125
+ end
126
+ #
117
127
  # end
118
128
  def maybe_deliver_email_confirmation!(controller)
119
129
  if email_changed_previously?
@@ -142,4 +152,6 @@ module Authlogic::ActsAsAuthentic::EmailToken::Confirmation
142
152
  e = read_attribute :new_email
143
153
  e.present? ? e : email
144
154
  end
155
+ # Rails' text_field helper calls new_email_before_typecast.
156
+ alias_method :new_email_before_type_cast, :new_email
145
157
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authlogic_email_token
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jarrett Colby
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-30 00:00:00.000000000 Z
11
+ date: 2014-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: authlogic