mirror of
https://github.com/documize/community.git
synced 2025-07-26 00:29:47 +02:00
Setting first/last name for all scenarios
This commit is contained in:
parent
399c36611f
commit
2ee9a9ff46
1 changed files with 10 additions and 6 deletions
|
@ -80,7 +80,7 @@ func (h *Handler) Authenticate(w http.ResponseWriter, r *http.Request) {
|
||||||
defer streamutil.Close(resp.Body)
|
defer streamutil.Close(resp.Body)
|
||||||
data, err := ioutil.ReadAll(resp.Body)
|
data, err := ioutil.ReadAll(resp.Body)
|
||||||
if err != nil {
|
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)
|
h.Runtime.Log.Error(method, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -113,12 +113,16 @@ func (h *Handler) Authenticate(w http.ResponseWriter, r *http.Request) {
|
||||||
u.GlobalAdmin = false
|
u.GlobalAdmin = false
|
||||||
u.Email = userInfo.User
|
u.Email = userInfo.User
|
||||||
|
|
||||||
u.Firstname = userInfo.Attributes.Get("first_name")
|
fn := userInfo.Attributes.Get("first_name")
|
||||||
u.Lastname = userInfo.Attributes.Get("last_name")
|
ln := userInfo.Attributes.Get("last_name")
|
||||||
if u.Firstname != "" || u.Lastname != "" {
|
if len(fn) > 0 || len(ln) > 0 {
|
||||||
u.Initials = stringutil.MakeInitials(u.Firstname, u.Lastname)
|
u.Initials = stringutil.MakeInitials(fn, ln)
|
||||||
}else {
|
u.Firstname = fn
|
||||||
|
u.Lastname = ln
|
||||||
|
} else {
|
||||||
u.Initials = stringutil.MakeInitials(userInfo.User, "")
|
u.Initials = stringutil.MakeInitials(userInfo.User, "")
|
||||||
|
u.Firstname = userInfo.User
|
||||||
|
u.Lastname = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
u.Salt = secrets.GenerateSalt()
|
u.Salt = secrets.GenerateSalt()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue