caboose-cms 0.2.82 → 0.2.83
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/app/controllers/caboose/users_controller.rb +44 -0
- data/app/views/caboose/users/my_account.html.erb +38 -0
- data/config/routes.rb +3 -0
- data/lib/caboose/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MWIxMDY1OTNjNWQ5NDIxMjRkMDRhYmE4ZWY3NzQwYTJjOTZjYWJlNw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MzExZGNkNTU4NmE1ZDAzNDBiZWNkMTFmZjU2NzUwY2I2NWUwZjA3Yg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NTIyYTI3NGExMDZjMjc2NWJjNmY1YTNmMTA3YWQzMDFiN2VlY2Q1MGU5OWMw
|
10
|
+
YzZhYTI1MzE1NzExZWRjMWY2MWMwZjExYjU3OWQzMTEyNTU0NTg0NTA2MmIy
|
11
|
+
MzUzNmY2NTUwMDhhMmMxNWM5NjJlNjk3NTQ4Nzc5ODVjNzZkMGE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MzUyYTM2OGNiNDdkMTdlNDUyYTE2NzhjNzQ0YTg0MTk2ZWY5YmIzYTJlZWQ1
|
14
|
+
NGQ4OWQ3YWRhMjc3YTI0MWU3ODY0NWUxNzhlYmMwZDM3NGQ4ZDhkZjNjOGFk
|
15
|
+
MTdiZjQxYzM5Y2I0NDgxMWY3YzJiMTVkNjdkMWYwMGY4ZDFiYmE=
|
@@ -7,6 +7,50 @@ module Caboose
|
|
7
7
|
@page = Page.page_with_uri('/admin')
|
8
8
|
end
|
9
9
|
|
10
|
+
#===========================================================================
|
11
|
+
# Non-admin actions
|
12
|
+
#===========================================================================
|
13
|
+
|
14
|
+
# GET /my-account
|
15
|
+
def my_account
|
16
|
+
return if !logged_in?
|
17
|
+
@user = logged_in_user
|
18
|
+
end
|
19
|
+
|
20
|
+
# PUT /my-account
|
21
|
+
def update_my_account
|
22
|
+
return if !logged_in?
|
23
|
+
|
24
|
+
resp = StdClass.new
|
25
|
+
user = logged_in_user
|
26
|
+
|
27
|
+
save = true
|
28
|
+
params.each do |name,value|
|
29
|
+
case name
|
30
|
+
when "first_name", "last_name", "username", "email", "phone"
|
31
|
+
user[name.to_sym] = value
|
32
|
+
when "password"
|
33
|
+
confirm = params[:confirm]
|
34
|
+
if (value != confirm)
|
35
|
+
resp.error = "Passwords do not match.";
|
36
|
+
save = false
|
37
|
+
elsif (value.length < 8)
|
38
|
+
resp.error = "Passwords must be at least 8 characters.";
|
39
|
+
save = false
|
40
|
+
else
|
41
|
+
user.password = Digest::SHA1.hexdigest(Caboose::salt + value)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
resp.success = save && user.save
|
47
|
+
render json: resp
|
48
|
+
end
|
49
|
+
|
50
|
+
#===========================================================================
|
51
|
+
# Admin actions
|
52
|
+
#===========================================================================
|
53
|
+
|
10
54
|
# GET /admin/users
|
11
55
|
def index
|
12
56
|
return if !user_is_allowed('users', 'view')
|
@@ -0,0 +1,38 @@
|
|
1
|
+
|
2
|
+
<h1>My Account</h1>
|
3
|
+
<div id='first_name' id='first_name' placeholder='First name' />
|
4
|
+
<div id='last_name' id='last_name' placeholder='Last name' />
|
5
|
+
<div id='email' id='email' placeholder='Email address' />
|
6
|
+
<div id='phone' id='phone' placeholder='Phone number' />
|
7
|
+
<div id='message'></div>
|
8
|
+
<p><input type='button' id='btn_cancel' value='Close' onclick="parent.$.fn.colorbox.close();" /></p>
|
9
|
+
|
10
|
+
<% content_for :caboose_js do %>
|
11
|
+
<script type='text/javascript'>
|
12
|
+
|
13
|
+
var modal = false;
|
14
|
+
$(window).load(function() {
|
15
|
+
modal = new CabooseModal(500);
|
16
|
+
});
|
17
|
+
|
18
|
+
$(document).ready(function() {
|
19
|
+
new ModelBinder({
|
20
|
+
name: 'User',
|
21
|
+
id: <%= @user.id %>,
|
22
|
+
update_url: '/my-account',
|
23
|
+
authenticity_token: '<%= form_authenticity_token %>',
|
24
|
+
attributes: [
|
25
|
+
{ name: 'first_name' , nice_name: 'First name' , type: 'text', value: <%= raw Caboose.json(@user.first_name) %>, width: 280 },
|
26
|
+
{ name: 'last_name' , nice_name: 'Last name' , type: 'text', value: <%= raw Caboose.json(@user.last_name) %>, width: 280 },
|
27
|
+
{ name: 'email' , nice_name: 'Email' , type: 'text', value: <%= raw Caboose.json(@user.email) %>, width: 280 },
|
28
|
+
{ name: 'phone' , nice_name: 'Phone Number' , type: 'text', value: <%= raw Caboose.json(@user.phone) %>, width: 280 }
|
29
|
+
],
|
30
|
+
on_load: function() { modal.autosize(); }
|
31
|
+
});
|
32
|
+
});
|
33
|
+
|
34
|
+
</script>
|
35
|
+
<% end %>
|
36
|
+
<%= content_for :caboose_css do %>
|
37
|
+
<%= stylesheet_link_tag "caboose/my-account", :media => "all" %>
|
38
|
+
<% end %>
|
data/config/routes.rb
CHANGED
@@ -11,6 +11,9 @@ Caboose::Engine.routes.draw do
|
|
11
11
|
get "register" => "register#index"
|
12
12
|
post "register" => "register#register"
|
13
13
|
|
14
|
+
get "my-account" => "users#my_account"
|
15
|
+
put "my-account" => "users#update_my_account"
|
16
|
+
|
14
17
|
get "admin/users" => "users#index"
|
15
18
|
get "admin/users/options" => "users#options"
|
16
19
|
get "admin/users/new" => "users#new"
|
data/lib/caboose/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: caboose-cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.83
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Barry
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -239,6 +239,7 @@ files:
|
|
239
239
|
- app/views/caboose/users/edit.html.erb
|
240
240
|
- app/views/caboose/users/edit_password.html.erb
|
241
241
|
- app/views/caboose/users/index.html.erb
|
242
|
+
- app/views/caboose/users/my_account.html.erb
|
242
243
|
- app/views/caboose/users/new.html.erb
|
243
244
|
- app/views/caboose/users/update_pic.html.erb
|
244
245
|
- app/views/layouts/caboose/_content.html.erb
|