1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-24 15:49:44 +02:00

Setting first/last name for all scenarios

This commit is contained in:
sauls8t 2019-08-18 15:23:01 +01:00
parent 399c36611f
commit 2ee9a9ff46

View file

@ -80,7 +80,7 @@ func (h *Handler) Authenticate(w http.ResponseWriter, r *http.Request) {
defer streamutil.Close(resp.Body)
data, err := ioutil.ReadAll(resp.Body)
if err != nil {
response.WriteBadRequestError(w, method, "Unable to verify CAS ticket: "+ a.Ticket)
response.WriteBadRequestError(w, method, "Unable to verify CAS ticket: "+a.Ticket)
h.Runtime.Log.Error(method, err)
return
}
@ -113,12 +113,16 @@ func (h *Handler) Authenticate(w http.ResponseWriter, r *http.Request) {
u.GlobalAdmin = false
u.Email = userInfo.User
u.Firstname = userInfo.Attributes.Get("first_name")
u.Lastname = userInfo.Attributes.Get("last_name")
if u.Firstname != "" || u.Lastname != "" {
u.Initials = stringutil.MakeInitials(u.Firstname, u.Lastname)
}else {
fn := userInfo.Attributes.Get("first_name")
ln := userInfo.Attributes.Get("last_name")
if len(fn) > 0 || len(ln) > 0 {
u.Initials = stringutil.MakeInitials(fn, ln)
u.Firstname = fn
u.Lastname = ln
} else {
u.Initials = stringutil.MakeInitials(userInfo.User, "")
u.Firstname = userInfo.User
u.Lastname = ""
}
u.Salt = secrets.GenerateSalt()