2024-06-30 06:31:21 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
|
|
class Settings::UsersController < ApplicationController
|
|
|
|
|
before_action :authenticate_user!
|
2024-07-16 16:26:16 -04:00
|
|
|
before_action :authenticate_admin!
|
2024-06-30 06:31:21 -04:00
|
|
|
|
|
|
|
|
def create
|
|
|
|
|
@user = User.new(
|
|
|
|
|
email: user_params[:email],
|
|
|
|
|
password: 'password',
|
|
|
|
|
password_confirmation: 'password'
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
if @user.save
|
2024-07-16 16:26:16 -04:00
|
|
|
redirect_to settings_url,
|
|
|
|
|
notice: "User was successfully created, email is #{@user.email}, password is \"password\"."
|
2024-06-30 06:31:21 -04:00
|
|
|
else
|
|
|
|
|
redirect_to settings_url, notice: 'User could not be created.', status: :unprocessable_entity
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
|
|
def user_params
|
|
|
|
|
params.require(:user).permit(:email)
|
|
|
|
|
end
|
|
|
|
|
end
|