Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
wattsworth
/
lumen-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
2e645090
authored
Feb 09, 2017
by
John Doe
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
set up password recovery
parent
b777997f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
9 deletions
app/controllers/application_controller.rb
app/views/devise/mailer/reset_password_instructions.html.erb
config/environments/development.rb
config/initializers/devise.rb
config/initializers/devise_token_auth.rb
app/controllers/application_controller.rb
View file @
2e645090
...
@@ -2,6 +2,11 @@
...
@@ -2,6 +2,11 @@
# application controller
# application controller
class
ApplicationController
<
ActionController
::
API
class
ApplicationController
<
ActionController
::
API
before_action
:configure_permitted_parameters
,
if: :devise_controller?
include
DeviseTokenAuth
::
Concerns
::
SetUserByToken
include
DeviseTokenAuth
::
Concerns
::
SetUserByToken
def
configure_permitted_parameters
devise_parameter_sanitizer
.
permit
(
:account_update
,
keys:
[
:first_name
,
:last_name
,
:email
])
end
end
end
app/views/devise/mailer/reset_password_instructions.html.erb
View file @
2e645090
<p>
<%=
t
(
:hello
).
capitalize
%>
<%=
@resource
.
email
%>
!
</p>
<p>
Hello
<%=
@resource
.
first_name
%>
!
</p>
<p>
<%=
t
'.request_reset_link_msg'
%>
</p>
Someone has requested a link to change your password.
You can do this through the link below.
<p>
<%=
link_to
t
(
'.password_change_link'
),
edit_password_url
(
@resource
,
reset_password_token:
@token
,
config:
message
[
'client-config'
].
to_s
,
redirect_url:
message
[
'redirect-url'
].
to_s
).
html_safe
%>
</p>
<p>
<%=
t
'.ignore_mail_msg'
%>
</p>
<p>
<%=
link_to
t
(
'.password_change_link'
),
edit_password_url
(
@resource
,
reset_password_token:
@token
,
config:
message
[
'client-config'
].
to_s
,
redirect_url:
message
[
'redirect-url'
].
to_s
).
html_safe
%>
</p>
<p>
<%=
t
'.no_changes_msg'
%>
</p>
<p>
\ No newline at end of file
If you didn't request this, please ignore this email.
</p>
<p>
Your password won't change until you access the link above and create a new one.
</p>
<p>
~wattsworth robot
</p>
config/environments/development.rb
View file @
2e645090
...
@@ -32,7 +32,7 @@ Rails.application.configure do
...
@@ -32,7 +32,7 @@ Rails.application.configure do
# Don't care if the mailer can't send.
# Don't care if the mailer can't send.
config
.
action_mailer
.
raise_delivery_errors
=
false
config
.
action_mailer
.
raise_delivery_errors
=
false
config
.
action_mailer
.
perform_caching
=
false
config
.
action_mailer
.
perform_caching
=
false
config
.
action_mailer
.
default_url_options
=
{
:host
=>
'
wattsworth.dev
'
}
config
.
action_mailer
.
default_url_options
=
{
:host
=>
'
localhost:3000
'
}
config
.
action_mailer
.
delivery_method
=
:smtp
config
.
action_mailer
.
delivery_method
=
:smtp
config
.
action_mailer
.
smtp_settings
=
config
.
action_mailer
.
smtp_settings
=
{
:address
=>
"localhost"
,
:port
=>
1025
}
{
:address
=>
"localhost"
,
:port
=>
1025
}
...
...
config/initializers/devise.rb
View file @
2e645090
Devise
.
setup
do
|
config
|
Devise
.
setup
do
|
config
|
# The e-mail address that mail will appear to be sent from
# The e-mail address that mail will appear to be sent from
# If absent, mail is sent from "please-change-me-at-config-initializers-devise@example.com"
# If absent, mail is sent from "please-change-me-at-config-initializers-devise@example.com"
config
.
mailer_sender
=
"support@
myapp.com
"
config
.
mailer_sender
=
"support@
wattsworth.net
"
# If using rails-api, you may want to tell devise to not use ActionDispatch::Flash
# If using rails-api, you may want to tell devise to not use ActionDispatch::Flash
# middleware b/c rails-api does not include it.
# middleware b/c rails-api does not include it.
...
...
config/initializers/devise_token_auth.rb
View file @
2e645090
...
@@ -3,7 +3,9 @@ DeviseTokenAuth.setup do |config|
...
@@ -3,7 +3,9 @@ DeviseTokenAuth.setup do |config|
# client is responsible for keeping track of the changing tokens. Change
# client is responsible for keeping track of the changing tokens. Change
# this to false to prevent the Authorization header from changing after
# this to false to prevent the Authorization header from changing after
# each request.
# each request.
# config.change_headers_on_each_request = true
config
.
change_headers_on_each_request
=
false
config
.
default_password_reset_url
=
"http://localhost:4200/session/reset_password"
# By default, users will need to re-authenticate after 2 weeks. This setting
# By default, users will need to re-authenticate after 2 weeks. This setting
# determines how long tokens will remain valid after they are issued.
# determines how long tokens will remain valid after they are issued.
...
...
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