mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-14 04:04:03 +00:00
implement user creation by admin
This commit is contained in:
parent
f057900fb1
commit
93404d543f
5 changed files with 93 additions and 21 deletions
|
|
@ -6,6 +6,17 @@ module Admin
|
|||
@user = User.new
|
||||
end
|
||||
|
||||
def create
|
||||
@user = User.new(user_params)
|
||||
@user.skip_confirmation!
|
||||
if @user.save
|
||||
redirect_to admin_users_path, notice: 'User successfully created.'
|
||||
else
|
||||
flash.now[:error] = "Creating User failed: #{@user.errors.full_messages.join('. ')}."
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
def index
|
||||
@users = User.all
|
||||
end
|
||||
|
|
@ -50,8 +61,9 @@ module Admin
|
|||
private
|
||||
|
||||
def user_params
|
||||
params.require(:user).permit(:email, :name, :email_public, :biography, :nickname, :affiliation, :is_admin, :username, :login, :is_disabled,
|
||||
:tshirt, :mobile, :volunteer_experience, :languages, :to_confirm, role_ids: [])
|
||||
params.require(:user).permit(:email, :name, :email_public, :biography, :nickname, :affiliation, :is_admin,
|
||||
:username, :login, :is_disabled, :tshirt, :mobile, :volunteer_experience,
|
||||
:languages, :to_confirm, :password, role_ids: [])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue