credible 0.3.0 → 0.4.0
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 534ceaffb085783354fb29b8e30cd25fc4bca42282b7c729798cda1e35eb4809
|
4
|
+
data.tar.gz: 7a30018164a97fef54c90deb80e92f607039cf1c9604ca740872859c9554bc89
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ef0e645f4f52194c7244ae550ca50c17e073e27b6c420b3a8f57ab92e284be098959f6af2fa926a05530c351d7c59206bbcfb5f9825c6f9212a4fe7f7fe128a
|
7
|
+
data.tar.gz: 7f7f48f126f381505c8c73c1122a249f47421d2feef5a84a726de35a8bb09a1f7e0650a64bcdcbcc7009d0895e4b7e04ec912838d4e0fb49f0b1f0cb6d257ca9
|
@@ -32,10 +32,10 @@ class Credible::Authentication::UsersController < Credible::AuthenticationContro
|
|
32
32
|
# GET /users/confirm/:confirmation_token
|
33
33
|
# GET /users/confirm/:confirmation_token.json
|
34
34
|
def confirm
|
35
|
-
@user = ::User.find_by(
|
35
|
+
@user = ::User.find_by(email: params[:email])
|
36
36
|
authorize @user
|
37
37
|
|
38
|
-
@user.confirm
|
38
|
+
@user.confirm(params[:confirmation_token])
|
39
39
|
|
40
40
|
if @user.save
|
41
41
|
@session = current_user ? current_session : ::Session.create(user: @user)
|
@@ -5,7 +5,7 @@ class Credible::UserMailer < ApplicationMailer
|
|
5
5
|
@app_name = Rails.application.class.module_parent_name
|
6
6
|
@user = params[:user]
|
7
7
|
@url = root_url
|
8
|
-
@confirmation_url = @url + 'confirm/' + @user.confirmation_token
|
8
|
+
@confirmation_url = @url + 'confirm/' + @user.confirmation_token + '?email=' + @user.email
|
9
9
|
mail(to: @user.email, subject: "Welcome to #{@app_name} | Please confirm your account")
|
10
10
|
end
|
11
11
|
|
data/lib/credible/user.rb
CHANGED
@@ -20,10 +20,12 @@ module Credible
|
|
20
20
|
validates_confirmation_of :password, allow_blank: true
|
21
21
|
# End custom password validation
|
22
22
|
|
23
|
-
def confirm
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
def confirm(token = nil)
|
24
|
+
if ActiveSupport::SecurityUtils.secure_compare(token, confirmation_token)
|
25
|
+
self.confirmation_token = nil
|
26
|
+
self.password = SecureRandom.hex(8) unless password_digest.present?
|
27
|
+
self.confirmed_at = Time.now.utc
|
28
|
+
end
|
27
29
|
end
|
28
30
|
|
29
31
|
def confirmed?
|
data/lib/credible/version.rb
CHANGED