Add dashboard, allow password resets when signed in
This commit is contained in:
@@ -2,4 +2,10 @@ class ApplicationController < ActionController::Base
|
||||
rescue_from DeviseLdapAuthenticatable::LdapException do |exception|
|
||||
render :text => exception, :status => 500
|
||||
end
|
||||
|
||||
def require_user_signed_in
|
||||
unless user_signed_in?
|
||||
redirect_to welcome_path and return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
6
app/controllers/dashboard_controller.rb
Normal file
6
app/controllers/dashboard_controller.rb
Normal file
@@ -0,0 +1,6 @@
|
||||
class DashboardController < ApplicationController
|
||||
before_action :require_user_signed_in
|
||||
|
||||
def index
|
||||
end
|
||||
end
|
||||
@@ -1,4 +1,13 @@
|
||||
class SettingsController < ApplicationController
|
||||
before_action :require_user_signed_in
|
||||
|
||||
def index
|
||||
end
|
||||
|
||||
def reset_password
|
||||
current_user.send_reset_password_instructions
|
||||
sign_out current_user
|
||||
msg = "We have sent you an email with a link to reset your password."
|
||||
redirect_to check_your_email_path, notice: msg
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
class WelcomeController < ApplicationController
|
||||
def index
|
||||
if user_signed_in?
|
||||
redirect_to settings_path and return
|
||||
redirect_to root_path and return
|
||||
end
|
||||
end
|
||||
|
||||
def reset_password_check_email
|
||||
end
|
||||
end
|
||||
|
||||
2
app/helpers/dashboard_helper.rb
Normal file
2
app/helpers/dashboard_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module DashboardHelper
|
||||
end
|
||||
9
app/views/dashboard/index.html.erb
Normal file
9
app/views/dashboard/index.html.erb
Normal file
@@ -0,0 +1,9 @@
|
||||
<h2>Dashboard</h2>
|
||||
<p>Ohai.</p>
|
||||
|
||||
<h3>Password change</h3>
|
||||
<p>
|
||||
<%= form_with(url: settings_reset_password_path, method: :post) do %>
|
||||
<%= submit_tag("Send me a password reset link") %>
|
||||
<% end %>
|
||||
</p>
|
||||
@@ -16,9 +16,12 @@
|
||||
Signed in as <strong><%= current_user.cn %>@kosmos.org</strong>.
|
||||
<%= link_to "Log out", destroy_user_session_path, method: :delete %>
|
||||
</p>
|
||||
<% flash.each do |type, msg| %>
|
||||
<% end %>
|
||||
|
||||
<% flash.each do |type, msg| %>
|
||||
<div class="flash-msg-<%= type %>">
|
||||
<p><%= msg %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= yield %>
|
||||
|
||||
@@ -1,4 +1 @@
|
||||
<h3>Password reset</h3>
|
||||
<p>
|
||||
<%= link_to "Reset my password" %>
|
||||
</p>
|
||||
<h2>Settings</h2>
|
||||
|
||||
3
app/views/welcome/check_your_email.html.erb
Normal file
3
app/views/welcome/check_your_email.html.erb
Normal file
@@ -0,0 +1,3 @@
|
||||
<p>
|
||||
You can close this window or tab now.
|
||||
</p>
|
||||
Reference in New Issue
Block a user