authlogic_email_token 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f3e77624dc5f9e2f5b129cd61a900028dbb7001
|
4
|
+
data.tar.gz: 35bdf3ee1f6cd7e54b22aecd88993f87c031094e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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
|
2
|
-
#
|
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
|
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
|
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
|
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.
|
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-
|
11
|
+
date: 2014-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: authlogic
|