require_dependency "wbase/application_controller" module Wbase class UsersController < ApplicationController before_action :require_login!, only: [:show, :update] def new @user = User.new render layout: 'wbase/auth' end def create @user = User.new(user_params) @user.verified = true if @user.save login(@user) AdminMailer.new_user(@user).deliver_later # CreateDripSubscriberJob.perform_later(@user.id) redirect_to '/' else flash.now[:errors] = @user.errors.full_messages render :new, layout: 'wbase/auth' end end def edit @user = current_user end def update @user = current_user if !@user.update(update_params) flash[:errors] = @user.errors.full_messages end redirect_to '/user' end def show @time_zones = ActiveSupport::TimeZone.us_zones.map(&:name) render layout: 'wbase/admin' end private def update_params params .require(:user) .permit( :email, :name, :initial_investment, :reinvest_percent, :facebook_page, :time_zone, :phone, :notify_email, :notify_text, :address_one, :address_two, :city, :state, :zip ) end def user_params params.require(:user).permit(:email, :password, :time_zone) end end end