Skip to content

Commit

Permalink
Assign default home in the users client dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
joseivanlopez committed Sep 30, 2021
1 parent 798af44 commit 68530a2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/lib/users/dialogs/inst_user_first.rb
Original file line number Diff line number Diff line change
Expand Up @@ -425,10 +425,26 @@ def process_new_user_form
@full_name = UI.QueryWidget(Id(:full_name), :Value)

user.name = @username
# In case of editing the user, the home should be updated to the default value (just in case
# the user name has changed) in order to keep the home path as /home/new_username.
user.home = user.default_home
user.gecos = [@full_name].compact

return false unless valid_user?

return false unless process_password

@autologin = UI.QueryWidget(Id(:autologin), :Value)

true
end

# Processes the password for the user
#
# Errors could be reported.
#
# @return [Boolean] if the password was correctly assigned to the user
def process_password
# password checks
pw1 = UI.QueryWidget(Id(:pw1), :Value)
pw2 = UI.QueryWidget(Id(:pw2), :Value)
Expand All @@ -444,9 +460,6 @@ def process_new_user_form
return false unless valid_password?(password)

user.password = password

@autologin = UI.QueryWidget(Id(:autologin), :Value)

true
end

Expand Down
1 change: 1 addition & 0 deletions test/lib/users/dialogs/inst_user_first_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@
subject.next_handler

expect(config.users.by_name("test")).to_not be_nil
expect(config.users.by_name("test").home.path).to eq("/home/test")
end

it "configures the autologin" do
Expand Down

0 comments on commit 68530a2

Please sign in to comment.