You can get logged in user by a GET request.
$.ajax({
async: false,
headers: { "accept": "application/json; odata=verbose" },
method: "GET",
url: formCtx.webAttributes.WebUrl + "/_api/web/CurrentUser",
success: function (data) {
currentUser = data.d;
}
});
Now use currentUser
in your CSR code. You may omit async if you can handle it properly.
_spPageContextInfo.userLoginName
will give you the current user alsouser's login name. So you can use it inside your CSR code if you need the login name only.