Skip to content

Commit

Permalink
If fullname is empty, shorname is used.
Browse files Browse the repository at this point in the history
  • Loading branch information
kenchan0130 committed Sep 5, 2022
1 parent f2540a6 commit 7764740
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion XCredsLoginPlugIn/Mechanisms/XCredsCreateUser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@ class XCredsCreateUser: XCredsBaseMechanism {

os_log("Checking for UserProfileImage key", log: createUserLog, type: .debug)

var userFullName = [first, last].joined(separator: " ").trimmingCharacters(in: .whitespaces)
if userFullName.isEmpty {
userFullName = shortName
}

var userPicture = getManagedPreference(key: .UserProfileImage) as? String ?? ""

Expand All @@ -236,7 +240,7 @@ class XCredsCreateUser: XCredsBaseMechanism {
// let picString = picData?.description ?? ""

var attrs: [AnyHashable:Any] = [
kODAttributeTypeFullName: [first + " " + last],
kODAttributeTypeFullName: [userFullName],
kODAttributeTypeNFSHomeDirectory: [ "/Users/" + shortName ],
kODAttributeTypeUserShell: ["/bin/bash"],
kODAttributeTypeUniqueID: [uid],
Expand Down

0 comments on commit 7764740

Please sign in to comment.