Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
O
OHR Support
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
97
Issues
97
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
OHR Support
Commits
ed252f72
Commit
ed252f72
authored
Apr 20, 2011
by
Eric Davis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[
#309
] Set the back_url after sending a lost password so HTTP_REFERER isn't used
Contributed by Robert Chady
parent
7f47401a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
2 deletions
+26
-2
account_controller.rb
app/controllers/account_controller.rb
+1
-1
account_test.rb
test/integration/account_test.rb
+25
-1
No files found.
app/controllers/account_controller.rb
View file @
ed252f72
...
@@ -67,7 +67,7 @@ class AccountController < ApplicationController
...
@@ -67,7 +67,7 @@ class AccountController < ApplicationController
if
token
.
save
if
token
.
save
Mailer
.
deliver_lost_password
(
token
)
Mailer
.
deliver_lost_password
(
token
)
flash
[
:notice
]
=
l
(
:notice_account_lost_email_sent
)
flash
[
:notice
]
=
l
(
:notice_account_lost_email_sent
)
redirect_to
:action
=>
'login'
redirect_to
:action
=>
'login'
,
:back_url
=>
home_url
return
return
end
end
end
end
...
...
test/integration/account_test.rb
View file @
ed252f72
...
@@ -77,7 +77,7 @@ class AccountTest < ActionController::IntegrationTest
...
@@ -77,7 +77,7 @@ class AccountTest < ActionController::IntegrationTest
assert_template
"account/lost_password"
assert_template
"account/lost_password"
post
"account/lost_password"
,
:mail
=>
'jSmith@somenet.foo'
post
"account/lost_password"
,
:mail
=>
'jSmith@somenet.foo'
assert_redirected_to
"/login"
assert_redirected_to
"/login
?back_url=http%3A%2F%2Fwww.example.com%2F
"
token
=
Token
.
find
(
:first
)
token
=
Token
.
find
(
:first
)
assert_equal
'recovery'
,
token
.
action
assert_equal
'recovery'
,
token
.
action
...
@@ -144,6 +144,30 @@ class AccountTest < ActionController::IntegrationTest
...
@@ -144,6 +144,30 @@ class AccountTest < ActionController::IntegrationTest
log_user
(
'newuser'
,
'newpass'
)
log_user
(
'newuser'
,
'newpass'
)
end
end
should_eventually
"login after losing password should redirect back to home"
do
visit
"/login"
assert_response
:success
click_link
"Lost password"
assert_response
:success
# Lost password form
fill_in
"mail"
,
:with
=>
"admin@somenet.foo"
click_button
"Submit"
assert_response
:success
# back to login page
assert_equal
"/login"
,
current_path
fill_in
"Login:"
,
:with
=>
'admin'
fill_in
"Password:"
,
:with
=>
'test'
click_button
"login"
assert_response
:success
assert_equal
"/"
,
current_path
end
if
Object
.
const_defined?
(
:Mocha
)
if
Object
.
const_defined?
(
:Mocha
)
def
test_onthefly_registration
def
test_onthefly_registration
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment