Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix 1923/inform user of session expiration #1953

Merged
merged 1 commit into from
Aug 30, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
import com.objectcomputing.checkins.services.memberprofile.MemberProfile;
import com.objectcomputing.checkins.services.memberprofile.MemberProfileUtils;
import com.objectcomputing.checkins.services.permissions.Permission;
import com.objectcomputing.checkins.services.permissions.PermissionRepository;
import com.objectcomputing.checkins.services.permissions.PermissionServices;
import com.objectcomputing.checkins.services.role.Role;
import com.objectcomputing.checkins.services.role.RoleRepository;
import com.objectcomputing.checkins.services.role.RoleServices;
import io.micronaut.http.HttpResponse;
import io.micronaut.http.annotation.Controller;
Expand Down Expand Up @@ -55,9 +53,9 @@ public HttpResponse<CurrentUserDTO> currentUser(@Nullable Authentication authent

String workEmail = authentication.getAttributes().get("email").toString();
String imageUrl = authentication.getAttributes().get("picture") != null ? authentication.getAttributes().get("picture").toString() : "";
String name = authentication.getAttributes().get("name").toString().trim();
String firstName = name.substring(0, name.indexOf(' '));
String lastName = name.substring(name.indexOf(' ') + 1).trim();
String name = authentication.getAttributes().get("name") != null ? authentication.getAttributes().get("name").toString().trim() : null;
String firstName = name != null ? name.substring(0, name.indexOf(' ')) : "";
String lastName = name != null ? name.substring(name.indexOf(' ') + 1).trim() : "";

MemberProfile user = currentUserServices.findOrSaveUser(firstName, lastName, workEmail);
List<Permission> permissions = permissionServices.findUserPermissions(user.getId());
Expand Down