forked from baron/baron-sso
feat: restore explicit loginId field and add to userfront signup flow
- Revert the removal of loginId from adminfront and backend. - Prevent phone normalization logic from mangling custom employee ID login fields. - Add an explicit 'loginId' optional input field to the userfront signup UI. - Update AuthProxyService.signup and backend AuthHandler.Signup to transmit and map the 'loginId' parameter properly.
This commit is contained in:
@@ -451,8 +451,23 @@ func (h *AuthHandler) Signup(c *fiber.Ctx) error {
|
||||
// grade는 기존 스키마 필수 키이므로 기본값을 설정
|
||||
"grade": "member",
|
||||
}
|
||||
|
||||
if req.LoginID != "" {
|
||||
attributes["id"] = req.LoginID
|
||||
}
|
||||
|
||||
// Sync custom field to LoginID if configured
|
||||
if tenantID != nil && h.TenantService != nil {
|
||||
if tenant, err := h.TenantService.GetTenant(c.Context(), *tenantID); err == nil && tenant != nil {
|
||||
if loginIdField, ok := tenant.Config["loginIdField"].(string); ok && loginIdField != "" {
|
||||
syncLoginID(attributes, req.Metadata, *tenantID, loginIdField)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
brokerUser := &domain.BrokerUser{
|
||||
Email: req.Email,
|
||||
LoginID: extractTraitString(attributes, "id"),
|
||||
Name: req.Name,
|
||||
PhoneNumber: normalizedPhone,
|
||||
Attributes: attributes,
|
||||
|
||||
Reference in New Issue
Block a user