caseadilla 0.0.1 → 0.0.2
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.
- checksums.yaml +4 -4
- data/.gitignore +0 -0
- data/Gemfile +0 -0
- data/LICENSE.txt +0 -0
- data/README.md +0 -0
- data/Rakefile +0 -0
- data/app/assets/fonts/caseadilla/glyphicons-halflings-regular.eot +0 -0
- data/app/assets/fonts/caseadilla/glyphicons-halflings-regular.svg +228 -228
- data/app/assets/fonts/caseadilla/glyphicons-halflings-regular.ttf +0 -0
- data/app/assets/fonts/caseadilla/glyphicons-halflings-regular.woff +0 -0
- data/app/assets/images/caseadilla/caseadilla.png +0 -0
- data/app/assets/javascripts/caseadilla/bootstrap.js +2114 -2114
- data/app/assets/javascripts/caseadilla/bootstrap3-wysihtml5.js +520 -520
- data/app/assets/javascripts/caseadilla/caseadilla.js +50 -50
- data/app/assets/javascripts/caseadilla/html5shiv.js +8 -8
- data/app/assets/javascripts/caseadilla/wysihtml5-0.3.0.min.js +260 -260
- data/app/assets/stylesheets/caseadilla/bootstrap-glyphicons.css.scss +2 -2
- data/app/assets/stylesheets/caseadilla/bootstrap-theme.css +442 -442
- data/app/assets/stylesheets/caseadilla/bootstrap-wysihtml5.css +101 -101
- data/app/assets/stylesheets/caseadilla/bootstrap.css +6203 -6203
- data/app/assets/stylesheets/caseadilla/caseadilla-bootstrap-overrides.css.scss +79 -79
- data/app/assets/stylesheets/caseadilla/caseadilla.scss +269 -269
- data/app/assets/stylesheets/caseadilla/login.css.scss +80 -80
- data/app/controllers/caseadilla/caseadilla_controller.rb +56 -56
- data/app/controllers/caseadilla/caseadilla_user_sessions_controller.rb +35 -35
- data/app/controllers/caseadilla/password_resets_controller.rb +63 -63
- data/app/controllers/caseadilla/roles_controller.rb +64 -64
- data/app/controllers/caseadilla/users_controller.rb +117 -117
- data/app/helpers/caseadilla/caseadilla_helper.rb +261 -261
- data/app/mailers/caseadilla/caseadilla_notification.rb +38 -38
- data/app/views/caseadilla/caseadilla/blank.html.erb +11 -11
- data/app/views/caseadilla/caseadilla_notification/generate_new_password.erb +11 -11
- data/app/views/caseadilla/caseadilla_notification/new_user_information.erb +11 -11
- data/app/views/caseadilla/caseadilla_notification/password_reset_instructions.erb +10 -10
- data/app/views/caseadilla/caseadilla_user_sessions/new.html.erb +38 -38
- data/app/views/caseadilla/roles/_form.html.erb +11 -11
- data/app/views/caseadilla/roles/_table.html.erb +27 -27
- data/app/views/caseadilla/roles/index.html.erb +14 -14
- data/app/views/caseadilla/roles/new.html.erb +17 -17
- data/app/views/caseadilla/roles/show.html.erb +17 -17
- data/app/views/caseadilla/users/index.html.erb +36 -36
- data/app/views/caseadilla/users/new.html.erb +49 -49
- data/app/views/caseadilla/users/show.html.erb +38 -38
- data/app/views/layouts/caseadilla_auth.html.erb +36 -36
- data/app/views/layouts/caseadilla_main.html.erb +110 -118
- data/caseadilla.gemspec +48 -48
- data/config/initializers/will_paginate.rb +39 -39
- data/config/routes.rb +22 -22
- data/lib/caseadilla.rb +13 -13
- data/lib/caseadilla/engine.rb +34 -34
- data/lib/caseadilla/version.rb +1 -1
- data/lib/generators/caseadilla/install/install_generator.rb +153 -153
- data/lib/generators/caseadilla/install/templates/app/assets/javascripts/caseadilla/custom.js +1 -1
- data/lib/generators/caseadilla/install/templates/app/assets/stylesheets/caseadilla/custom.css.scss +2 -2
- data/lib/generators/caseadilla/install/templates/app/helpers/caseadilla/config_helper.rb +44 -44
- data/lib/generators/caseadilla/install/templates/app/models/user.rb +23 -23
- data/lib/generators/caseadilla/install/templates/app/views/caseadilla/layouts/_tab_navigation.html.erb +1 -1
- data/lib/generators/caseadilla/install/templates/app/views/caseadilla/layouts/_top_navigation.html.erb +3 -3
- data/lib/generators/caseadilla/install/templates/public/robots.txt +4 -4
- data/lib/generators/caseadilla/install/templates/steak/config/initializers/caseadilla.rb +7 -7
- data/lib/generators/caseadilla/install/templates/steak/db/migrate/add_name_to_users.rb +8 -8
- data/lib/generators/caseadilla/install/templates/veggie/config/initializers/caseadilla.rb +7 -7
- data/lib/generators/caseadilla/scaffold/scaffold_generator.rb +110 -110
- data/lib/generators/caseadilla/scaffold/templates/controller.rb +71 -71
- data/lib/generators/caseadilla/scaffold/templates/migration.rb +12 -12
- data/lib/generators/caseadilla/scaffold/templates/model.rb +2 -2
- data/lib/generators/caseadilla/scaffold/templates/views/_form.html.erb +11 -11
- data/lib/generators/caseadilla/scaffold/templates/views/_table.html.erb +18 -18
- data/lib/generators/caseadilla/scaffold/templates/views/index.html.erb +14 -14
- data/lib/generators/caseadilla/scaffold/templates/views/new.html.erb +17 -17
- data/lib/generators/caseadilla/scaffold/templates/views/show.html.erb +17 -17
- data/lib/railties/tasks.rake +31 -31
- metadata +2 -2
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
/*
|
|
2
|
-
*= require ./bootstrap.css
|
|
3
|
-
*= require ./bootstrap-glyphicons.css
|
|
4
|
-
*= require ./caseadilla-bootstrap-overrides.css
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
body {
|
|
8
|
-
padding-top: 0px;
|
|
9
|
-
padding-bottom: 0px;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.container-narrow {
|
|
13
|
-
margin: 0 auto;
|
|
14
|
-
max-width: 400px;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.alert {
|
|
18
|
-
text-align: center;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.brand {
|
|
22
|
-
margin-top: 20px;
|
|
23
|
-
margin-bottom: 40px;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.form-group .checkbox-inline label {
|
|
27
|
-
margin-top: 5px;
|
|
28
|
-
margin-bottom: 20px;
|
|
29
|
-
font-weight: normal;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.form-group .checkbox-inline input[type="checkbox"] {
|
|
33
|
-
margin-top: 1px;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.form-group input {
|
|
37
|
-
text-align: center;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
form#new_user input.btn-large {
|
|
41
|
-
background-color: rgb(220, 120, 40);
|
|
42
|
-
border-color: rgb(175, 92, 32);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.jumbotron {
|
|
46
|
-
padding: 20px;
|
|
47
|
-
margin-bottom: 20px;
|
|
48
|
-
font-size: 14px;
|
|
49
|
-
line-height: 1;
|
|
50
|
-
background-color: #eeeeee;
|
|
51
|
-
text-align: center;
|
|
52
|
-
border-bottom: 1px solid #e5e5e5;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
footer p {
|
|
56
|
-
font-size: 13px;
|
|
57
|
-
text-align: center;
|
|
58
|
-
color: #888;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
footer p a {
|
|
62
|
-
color: #555;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
footer p a:hover {
|
|
66
|
-
color: #000;
|
|
67
|
-
text-decoration: none;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
@media screen and (min-width: 768px) {
|
|
71
|
-
.jumbotron {
|
|
72
|
-
border-bottom: 0;
|
|
73
|
-
padding: 20px;
|
|
74
|
-
border-radius: 6px;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
body {
|
|
78
|
-
padding-top: 40px;
|
|
79
|
-
padding-bottom: 20px;
|
|
80
|
-
}
|
|
1
|
+
/*
|
|
2
|
+
*= require ./bootstrap.css
|
|
3
|
+
*= require ./bootstrap-glyphicons.css
|
|
4
|
+
*= require ./caseadilla-bootstrap-overrides.css
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
body {
|
|
8
|
+
padding-top: 0px;
|
|
9
|
+
padding-bottom: 0px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.container-narrow {
|
|
13
|
+
margin: 0 auto;
|
|
14
|
+
max-width: 400px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.alert {
|
|
18
|
+
text-align: center;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.brand {
|
|
22
|
+
margin-top: 20px;
|
|
23
|
+
margin-bottom: 40px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.form-group .checkbox-inline label {
|
|
27
|
+
margin-top: 5px;
|
|
28
|
+
margin-bottom: 20px;
|
|
29
|
+
font-weight: normal;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.form-group .checkbox-inline input[type="checkbox"] {
|
|
33
|
+
margin-top: 1px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.form-group input {
|
|
37
|
+
text-align: center;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
form#new_user input.btn-large {
|
|
41
|
+
background-color: rgb(220, 120, 40);
|
|
42
|
+
border-color: rgb(175, 92, 32);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.jumbotron {
|
|
46
|
+
padding: 20px;
|
|
47
|
+
margin-bottom: 20px;
|
|
48
|
+
font-size: 14px;
|
|
49
|
+
line-height: 1;
|
|
50
|
+
background-color: #eeeeee;
|
|
51
|
+
text-align: center;
|
|
52
|
+
border-bottom: 1px solid #e5e5e5;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
footer p {
|
|
56
|
+
font-size: 13px;
|
|
57
|
+
text-align: center;
|
|
58
|
+
color: #888;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
footer p a {
|
|
62
|
+
color: #555;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
footer p a:hover {
|
|
66
|
+
color: #000;
|
|
67
|
+
text-decoration: none;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@media screen and (min-width: 768px) {
|
|
71
|
+
.jumbotron {
|
|
72
|
+
border-bottom: 0;
|
|
73
|
+
padding: 20px;
|
|
74
|
+
border-radius: 6px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
body {
|
|
78
|
+
padding-top: 40px;
|
|
79
|
+
padding-bottom: 20px;
|
|
80
|
+
}
|
|
81
81
|
}
|
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
module Caseadilla
|
|
2
|
-
class CaseadillaController < ApplicationController
|
|
3
|
-
|
|
4
|
-
require 'caseadilla/caseadilla_helper'
|
|
5
|
-
include Caseadilla::CaseadillaHelper
|
|
6
|
-
|
|
7
|
-
require 'caseadilla/config_helper'
|
|
8
|
-
include Caseadilla::ConfigHelper
|
|
9
|
-
|
|
10
|
-
layout 'caseadilla_main'
|
|
11
|
-
|
|
12
|
-
# before_filter :set_time_zone
|
|
13
|
-
before_action :require_sign_in
|
|
14
|
-
|
|
15
|
-
ActionView::Base.field_error_proc = proc { |input, instance| "#{input}".html_safe }
|
|
16
|
-
|
|
17
|
-
def index
|
|
18
|
-
redirect_to caseadilla_config_dashboard_url
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def blank
|
|
22
|
-
@caseadilla_page_title = "Welcome"
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
private
|
|
26
|
-
|
|
27
|
-
def steak?
|
|
28
|
-
return false unless Caseadilla::Engine.flavor = :steak
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def chicken?
|
|
32
|
-
return false unless Caseadilla::Engine.flavor = :chicken
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def veggie?
|
|
36
|
-
return false unless Caseadilla::Engine.flavor = :veggie
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
# def set_time_zone
|
|
40
|
-
# Time.zone = current_user.time_zone if current_user
|
|
41
|
-
# end
|
|
42
|
-
|
|
43
|
-
def redirect_back_or_default(default)
|
|
44
|
-
redirect_to(session[:return_to] || default)
|
|
45
|
-
session[:return_to] = nil
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def sort_order(default)
|
|
49
|
-
"#{(params[:c] || default.to_s).gsub(/[\s;'\"]/,'')} #{'ASC' if params[:d] == 'up'} #{'DESC' if params[:d] == 'down'}"
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
def require_sign_in
|
|
53
|
-
redirect_to caseadilla_sign_in_path unless user_signed_in?
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
end
|
|
1
|
+
module Caseadilla
|
|
2
|
+
class CaseadillaController < ApplicationController
|
|
3
|
+
|
|
4
|
+
require 'caseadilla/caseadilla_helper'
|
|
5
|
+
include Caseadilla::CaseadillaHelper
|
|
6
|
+
|
|
7
|
+
require 'caseadilla/config_helper'
|
|
8
|
+
include Caseadilla::ConfigHelper
|
|
9
|
+
|
|
10
|
+
layout 'caseadilla_main'
|
|
11
|
+
|
|
12
|
+
# before_filter :set_time_zone
|
|
13
|
+
before_action :require_sign_in
|
|
14
|
+
|
|
15
|
+
ActionView::Base.field_error_proc = proc { |input, instance| "#{input}".html_safe }
|
|
16
|
+
|
|
17
|
+
def index
|
|
18
|
+
redirect_to caseadilla_config_dashboard_url
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def blank
|
|
22
|
+
@caseadilla_page_title = "Welcome"
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
private
|
|
26
|
+
|
|
27
|
+
def steak?
|
|
28
|
+
return false unless Caseadilla::Engine.flavor = :steak
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def chicken?
|
|
32
|
+
return false unless Caseadilla::Engine.flavor = :chicken
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def veggie?
|
|
36
|
+
return false unless Caseadilla::Engine.flavor = :veggie
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# def set_time_zone
|
|
40
|
+
# Time.zone = current_user.time_zone if current_user
|
|
41
|
+
# end
|
|
42
|
+
|
|
43
|
+
def redirect_back_or_default(default)
|
|
44
|
+
redirect_to(session[:return_to] || default)
|
|
45
|
+
session[:return_to] = nil
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def sort_order(default)
|
|
49
|
+
"#{(params[:c] || default.to_s).gsub(/[\s;'\"]/,'')} #{'ASC' if params[:d] == 'up'} #{'DESC' if params[:d] == 'down'}"
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def require_sign_in
|
|
53
|
+
redirect_to caseadilla_sign_in_path unless user_signed_in?
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
end
|
|
57
57
|
end
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
module Caseadilla
|
|
2
|
-
class CaseadillaUserSessionsController < Caseadilla::CaseadillaController
|
|
3
|
-
|
|
4
|
-
skip_before_action :require_sign_in, :only => [:new, :create]
|
|
5
|
-
before_filter :requires_no_session_user, :except => [:destroy]
|
|
6
|
-
|
|
7
|
-
layout 'caseadilla_auth'
|
|
8
|
-
|
|
9
|
-
def new
|
|
10
|
-
@user_session = nil
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def create
|
|
14
|
-
@user_session = nil
|
|
15
|
-
if @user_session.save
|
|
16
|
-
redirect_back_or_default :controller => :caseadilla, :action => :index
|
|
17
|
-
else
|
|
18
|
-
render :action => :new
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def destroy
|
|
23
|
-
current_user_session.destroy
|
|
24
|
-
redirect_back_or_default new_caseadilla_user_session_url
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
private
|
|
28
|
-
|
|
29
|
-
def requires_no_session_user
|
|
30
|
-
if current_user
|
|
31
|
-
redirect_to :controller => :caseadilla, :action => :index
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
end
|
|
1
|
+
module Caseadilla
|
|
2
|
+
class CaseadillaUserSessionsController < Caseadilla::CaseadillaController
|
|
3
|
+
|
|
4
|
+
skip_before_action :require_sign_in, :only => [:new, :create]
|
|
5
|
+
before_filter :requires_no_session_user, :except => [:destroy]
|
|
6
|
+
|
|
7
|
+
layout 'caseadilla_auth'
|
|
8
|
+
|
|
9
|
+
def new
|
|
10
|
+
@user_session = nil
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def create
|
|
14
|
+
@user_session = nil
|
|
15
|
+
if @user_session.save
|
|
16
|
+
redirect_back_or_default :controller => :caseadilla, :action => :index
|
|
17
|
+
else
|
|
18
|
+
render :action => :new
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def destroy
|
|
23
|
+
current_user_session.destroy
|
|
24
|
+
redirect_back_or_default new_caseadilla_user_session_url
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
private
|
|
28
|
+
|
|
29
|
+
def requires_no_session_user
|
|
30
|
+
if current_user
|
|
31
|
+
redirect_to :controller => :caseadilla, :action => :index
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
end
|
|
36
36
|
end
|
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
module Caseadilla
|
|
2
|
-
class PasswordResetsController < Caseadilla::CaseadillaController
|
|
3
|
-
|
|
4
|
-
skip_before_filter :authorise
|
|
5
|
-
before_filter :load_user_using_perishable_token, :only => [:edit, :update]
|
|
6
|
-
|
|
7
|
-
layout 'caseadilla_auth'
|
|
8
|
-
|
|
9
|
-
def create
|
|
10
|
-
users = Caseadilla::User.where(:email => params[:recover_email]).all
|
|
11
|
-
|
|
12
|
-
if users.length > 0
|
|
13
|
-
users.each do |user|
|
|
14
|
-
user.send_password_reset_instructions
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
if users.length > 1
|
|
18
|
-
flash[:notice] = "Multiple accounts were found. Emails have been sent to " + params[:recover_email] + " with instructions on how to reset your passwords"
|
|
19
|
-
else
|
|
20
|
-
flash[:notice] = "An email has been sent to " + params[:recover_email] + " with instructions on how to reset your password"
|
|
21
|
-
end
|
|
22
|
-
else
|
|
23
|
-
flash[:warning] = "There is no user with that email"
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
redirect_to new_caseadilla_user_session_url
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def edit
|
|
30
|
-
render
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def update
|
|
34
|
-
|
|
35
|
-
if params[:caseadilla_user][:password].empty? || params[:caseadilla_user][:password_confirmation].empty?
|
|
36
|
-
flash.now[:warning] = "A field has been left empty"
|
|
37
|
-
else
|
|
38
|
-
|
|
39
|
-
@reset_user.password = params[:caseadilla_user][:password]
|
|
40
|
-
@reset_user.password_confirmation = params[:caseadilla_user][:password_confirmation]
|
|
41
|
-
|
|
42
|
-
if @reset_user.save
|
|
43
|
-
flash[:notice] = "Password successfully updated"
|
|
44
|
-
redirect_to new_caseadilla_user_session_url
|
|
45
|
-
return
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
render :action => :edit
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
private
|
|
53
|
-
|
|
54
|
-
def load_user_using_perishable_token
|
|
55
|
-
|
|
56
|
-
@reset_user = Caseadilla::User.find_using_perishable_token params[:token]
|
|
57
|
-
|
|
58
|
-
unless @reset_user
|
|
59
|
-
flash[:warning] = "Your account could not be located. Try to copy and paste the URL directly from the email."
|
|
60
|
-
redirect_to new_caseadilla_user_session_url
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
end
|
|
1
|
+
module Caseadilla
|
|
2
|
+
class PasswordResetsController < Caseadilla::CaseadillaController
|
|
3
|
+
|
|
4
|
+
skip_before_filter :authorise
|
|
5
|
+
before_filter :load_user_using_perishable_token, :only => [:edit, :update]
|
|
6
|
+
|
|
7
|
+
layout 'caseadilla_auth'
|
|
8
|
+
|
|
9
|
+
def create
|
|
10
|
+
users = Caseadilla::User.where(:email => params[:recover_email]).all
|
|
11
|
+
|
|
12
|
+
if users.length > 0
|
|
13
|
+
users.each do |user|
|
|
14
|
+
user.send_password_reset_instructions
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
if users.length > 1
|
|
18
|
+
flash[:notice] = "Multiple accounts were found. Emails have been sent to " + params[:recover_email] + " with instructions on how to reset your passwords"
|
|
19
|
+
else
|
|
20
|
+
flash[:notice] = "An email has been sent to " + params[:recover_email] + " with instructions on how to reset your password"
|
|
21
|
+
end
|
|
22
|
+
else
|
|
23
|
+
flash[:warning] = "There is no user with that email"
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
redirect_to new_caseadilla_user_session_url
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def edit
|
|
30
|
+
render
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def update
|
|
34
|
+
|
|
35
|
+
if params[:caseadilla_user][:password].empty? || params[:caseadilla_user][:password_confirmation].empty?
|
|
36
|
+
flash.now[:warning] = "A field has been left empty"
|
|
37
|
+
else
|
|
38
|
+
|
|
39
|
+
@reset_user.password = params[:caseadilla_user][:password]
|
|
40
|
+
@reset_user.password_confirmation = params[:caseadilla_user][:password_confirmation]
|
|
41
|
+
|
|
42
|
+
if @reset_user.save
|
|
43
|
+
flash[:notice] = "Password successfully updated"
|
|
44
|
+
redirect_to new_caseadilla_user_session_url
|
|
45
|
+
return
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
render :action => :edit
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
private
|
|
53
|
+
|
|
54
|
+
def load_user_using_perishable_token
|
|
55
|
+
|
|
56
|
+
@reset_user = Caseadilla::User.find_using_perishable_token params[:token]
|
|
57
|
+
|
|
58
|
+
unless @reset_user
|
|
59
|
+
flash[:warning] = "Your account could not be located. Try to copy and paste the URL directly from the email."
|
|
60
|
+
redirect_to new_caseadilla_user_session_url
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
64
|
end
|