39 lines
868 B
Ruby
39 lines
868 B
Ruby
class SettingsController < ApplicationController
|
|
before_action :authenticate_user!
|
|
before_action :set_main_nav_section
|
|
before_action :set_settings_section, only: ['show', 'update']
|
|
|
|
def index
|
|
redirect_to setting_path(:profile)
|
|
end
|
|
|
|
def show
|
|
@user = current_user
|
|
end
|
|
|
|
def update
|
|
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
|
|
|
|
private
|
|
|
|
def set_main_nav_section
|
|
@current_section = :settings
|
|
end
|
|
|
|
def set_settings_section
|
|
@settings_section = params[:section]
|
|
allowed_sections = [:profile, :account, :notifications]
|
|
|
|
unless allowed_sections.include?(@settings_section.to_sym)
|
|
redirect_to setting_path(:profile)
|
|
end
|
|
end
|
|
end
|