lobby 0.0.1a → 0.0.1h
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.
- data/app/models/{lobby/auth_user.rb~ → auth_user.rb} +0 -0
- data/app/models/{lobby/authentication.rb → authentication.rb} +1 -1
- data/app/models/{lobby/password_forgotten_form_abstract.rb → password_forgotten_form_abstract.rb} +0 -0
- data/lib/lobby/version.rb +1 -1
- data/lib/lobby/version.rb~ +1 -1
- metadata +4 -5
- data/app/models/lobby/auth_user.rb +0 -100
File without changes
|
data/app/models/{lobby/password_forgotten_form_abstract.rb → password_forgotten_form_abstract.rb}
RENAMED
File without changes
|
data/lib/lobby/version.rb
CHANGED
data/lib/lobby/version.rb~
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lobby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.1h
|
5
5
|
prerelease: 5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -103,12 +103,11 @@ files:
|
|
103
103
|
- app/controllers/lobby/password_forgotten_controller.rb
|
104
104
|
- app/helpers/lobby/application_helper.rb
|
105
105
|
- app/models/authentication.rb~
|
106
|
-
- app/models/
|
107
|
-
- app/models/lobby/auth_user.rb~
|
108
|
-
- app/models/lobby/authentication.rb
|
109
|
-
- app/models/lobby/password_forgotten_form_abstract.rb
|
106
|
+
- app/models/auth_user.rb
|
110
107
|
- app/models/auth_user.rb~
|
108
|
+
- app/models/authentication.rb
|
111
109
|
- app/models/password_forgotten_form_abstract.rb~
|
110
|
+
- app/models/password_forgotten_form_abstract.rb
|
112
111
|
- config/locales/de.yml
|
113
112
|
- config/locales/en.yml~
|
114
113
|
- config/locales/en.yml
|
@@ -1,100 +0,0 @@
|
|
1
|
-
module Lobby
|
2
|
-
module AuthUser
|
3
|
-
|
4
|
-
def self.included(base)
|
5
|
-
base.has_secure_password
|
6
|
-
|
7
|
-
base.validates :email, presence: true
|
8
|
-
base.validates :email, format: {with: EMAIL_REGEX, multiline: true}, if: Proc.new { |u| u.email.present? }
|
9
|
-
base.validates :email, uniqueness: true, :unless => :confirmed_duplicate, :on => :create, if: Proc.new { |u| u.email.present? }
|
10
|
-
base.validates :password, length: { minimum: 5 }, :on => :create, if: Proc.new { |u| u.password.present? }
|
11
|
-
|
12
|
-
base.extend ClassMethods
|
13
|
-
end
|
14
|
-
|
15
|
-
|
16
|
-
module ClassMethods
|
17
|
-
def confirmed
|
18
|
-
where("confirmed IS NOT NULL")
|
19
|
-
end
|
20
|
-
|
21
|
-
def with_email(email)
|
22
|
-
where(:email => email)
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
26
|
-
|
27
|
-
|
28
|
-
def confirmed_duplicate(test_mail = self.email)
|
29
|
-
if ((self.class.name.constantize.confirmed.with_email(test_mail).count == 0) ||
|
30
|
-
(self.class.name.constantize.with_email(test_mail).count == 0))
|
31
|
-
true
|
32
|
-
else
|
33
|
-
#self.id = self.class.name.constantize.confirmed.with_email(test_mail).first.id
|
34
|
-
false
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def confirm_signup!
|
39
|
-
update_attribute(:confirmed, Time.now)
|
40
|
-
update_attribute(:signup_token, nil)
|
41
|
-
update_attribute(:active, true)
|
42
|
-
end
|
43
|
-
|
44
|
-
def confirm_new_email!
|
45
|
-
update_attribute(:email, new_email)
|
46
|
-
update_attribute(:new_email_token, nil)
|
47
|
-
end
|
48
|
-
|
49
|
-
def confirmed?
|
50
|
-
!self.confirmed.nil?
|
51
|
-
end
|
52
|
-
|
53
|
-
def active?
|
54
|
-
self.active == true
|
55
|
-
end
|
56
|
-
|
57
|
-
# Wenn der User sich registriert, dann wird ein signup_token für ihn hinterlegt.
|
58
|
-
# Dieser Token wird per Mail verschickt. Der User kann sich nun per Klick auf den
|
59
|
-
# Tokenlink verifizieren. Sollte die Mail nicht mehr erreichbar sein, so kann der User
|
60
|
-
# unter Angabe seiner Email einen neuen signup_Token anfordern. Der alte Token ist
|
61
|
-
# ab diesem Zeitpunkt ungültig.
|
62
|
-
|
63
|
-
# Nach erfolgreicher Verifizierung der Email-Adresse) wird das
|
64
|
-
# Feld confirmed mit einem Datum gefüllt. Ab diesem Zeitpunkt kann keine neuer
|
65
|
-
# Confirmation-Token generiert und verschickt werden.
|
66
|
-
|
67
|
-
def tokenmail(request)
|
68
|
-
ConfirmationMailer.send(request, self).deliver
|
69
|
-
end
|
70
|
-
|
71
|
-
def send_password_reset(with_mail = true)
|
72
|
-
return unless generate_token(:password_token)
|
73
|
-
if with_mail
|
74
|
-
tokenmail(:send_password_reset)
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
def send_registration
|
79
|
-
return unless generate_token(:signup_token)
|
80
|
-
tokenmail(:registration)
|
81
|
-
end
|
82
|
-
|
83
|
-
def resend_signup_token
|
84
|
-
return unless (!confirmed? && generate_token(:signup_token))
|
85
|
-
tokenmail(:resend_signup_token)
|
86
|
-
end
|
87
|
-
|
88
|
-
def send_new_email_request
|
89
|
-
return unless (confirmed? && generate_token(:new_email_token))
|
90
|
-
tokenmail(:new_email_request)
|
91
|
-
end
|
92
|
-
|
93
|
-
|
94
|
-
private
|
95
|
-
|
96
|
-
def generate_token( token )
|
97
|
-
(defined?( token ) && update_attribute( token, SecureRandom.hex(13) ))? true : false
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|