volt-user_templates 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 +4 -4
- data/README.md +1 -0
- data/VERSION +1 -1
- data/app/user_templates/controllers/account_controller.rb +1 -1
- data/app/user_templates/controllers/login_controller.rb +1 -0
- data/app/user_templates/controllers/menu_controller.rb +7 -2
- data/app/user_templates/controllers/password_reset_controller.rb +10 -0
- data/app/user_templates/tasks/password_reset_tasks.rb +5 -0
- data/app/user_templates/tasks/user_template_tasks.rb +10 -5
- data/app/user_templates/views/password_reset/index.html +10 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 145bf08ec26e29200d73efe316caeec2374efe25
|
4
|
+
data.tar.gz: eb4990ffeb13fae9a9c107116b6cce6d26d1944b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69a7cca480dcb1d833dc0ca04341191388d2bb555e4bbc0cc90b4bf759e7784c01ec5fab592af922762b05bc376575b86745ae7d3afaf539310f7549383c7a8a
|
7
|
+
data.tar.gz: 52daf097444a39267f1fe516daf7680dba838f976845cb8a41addd3d2aef12f08438ec4ead2badc036414003cc5763eba0635ceab285f76e3c9cb89f3dfc5417
|
data/README.md
CHANGED
@@ -28,6 +28,7 @@ Add the following to your main components route file:
|
|
28
28
|
|
29
29
|
```ruby
|
30
30
|
client '/signup', component: 'user_templates', controller: 'signup'
|
31
|
+
client '/password_reset', component: 'user_templates', controller: 'password_reset', action: 'index'
|
31
32
|
client '/forgot', component: 'user_templates', controller: 'login', action: 'forgot'
|
32
33
|
client '/login', component: 'user_templates', controller: 'login', action: 'index'
|
33
34
|
```
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
@@ -1,8 +1,13 @@
|
|
1
1
|
module UserTemplates
|
2
2
|
class MenuController < Volt::ModelController
|
3
3
|
def show_name
|
4
|
-
Volt.
|
5
|
-
|
4
|
+
Volt.current_user.then do |user|
|
5
|
+
# Make sure there is a user
|
6
|
+
if user
|
7
|
+
user._name || user._email || user._username
|
8
|
+
else
|
9
|
+
''
|
10
|
+
end
|
6
11
|
end
|
7
12
|
end
|
8
13
|
|
@@ -1,10 +1,6 @@
|
|
1
1
|
require 'digest'
|
2
2
|
|
3
3
|
class UserTemplateTasks < Volt::Task
|
4
|
-
def password_reset_token(user_id)
|
5
|
-
Digest::SHA256.hexdigest("#{user_id}||#{Volt.config.app_secret}")
|
6
|
-
end
|
7
|
-
|
8
4
|
def send_reset_email(email)
|
9
5
|
# Find user by e-mail
|
10
6
|
Volt.skip_permissions do
|
@@ -12,7 +8,11 @@ class UserTemplateTasks < Volt::Task
|
|
12
8
|
if user
|
13
9
|
reset_token = password_reset_token(user.id)
|
14
10
|
|
15
|
-
|
11
|
+
reset_base_url = url_for(component: 'user_templates',
|
12
|
+
controller: 'password_reset', action: 'index')
|
13
|
+
|
14
|
+
reset_url = "http://#{Volt.config.domain}/#{reset_base_url}/?"
|
15
|
+
+ "user_id=#{user_id}&token=#{reset_token}"
|
16
16
|
|
17
17
|
Mailer.deliver('user_templates/mailers/forgot',
|
18
18
|
{to: email, name: user._name, reset_url: reset_url}
|
@@ -23,4 +23,9 @@ class UserTemplateTasks < Volt::Task
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
26
|
+
|
27
|
+
private
|
28
|
+
def password_reset_token(user_id)
|
29
|
+
Digest::SHA256.hexdigest("#{user_id}||#{Volt.config.app_secret}")
|
30
|
+
end
|
26
31
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: volt-user_templates
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Stout
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05
|
11
|
+
date: 2015-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: volt-fields
|
@@ -69,13 +69,16 @@ files:
|
|
69
69
|
- app/user_templates/controllers/account_controller.rb
|
70
70
|
- app/user_templates/controllers/login_controller.rb
|
71
71
|
- app/user_templates/controllers/menu_controller.rb
|
72
|
+
- app/user_templates/controllers/password_reset_controller.rb
|
72
73
|
- app/user_templates/controllers/signup_controller.rb
|
74
|
+
- app/user_templates/tasks/password_reset_tasks.rb
|
73
75
|
- app/user_templates/tasks/user_template_tasks.rb
|
74
76
|
- app/user_templates/views/account/index.html
|
75
77
|
- app/user_templates/views/login/forgot.html
|
76
78
|
- app/user_templates/views/login/index.html
|
77
79
|
- app/user_templates/views/mailers/forgot.email
|
78
80
|
- app/user_templates/views/menu/index.html
|
81
|
+
- app/user_templates/views/password_reset/index.html
|
79
82
|
- app/user_templates/views/signup/index.html
|
80
83
|
- lib/volt/user-templates.rb
|
81
84
|
- volt-user_templates.gemspec
|