mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-10 17:21:38 -05:00
26 lines
656 B
Ruby
26 lines
656 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Settings::UsersController < ApplicationController
|
|
before_action :authenticate_user!
|
|
before_action :authenticate_first_user!
|
|
|
|
def create
|
|
@user = User.new(
|
|
email: user_params[:email],
|
|
password: 'password',
|
|
password_confirmation: 'password'
|
|
)
|
|
|
|
if @user.save
|
|
redirect_to settings_url, notice: "User was successfully created, email is #{@user.email}, password is \"password\"."
|
|
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
|