I am able to add member login for the website with active directory. Right now, I have a button which user has to click and then the azure ad login is taking place. How can I change this to auto login?
So I don't know if you are still having the same issue, but i found a "hack" which allows us to move forward. We have used Azure AD on projects not in Umbraco and I couldn't figure out how to implement this in Umbraco.
So i went with another approach. On the main template page i put a fragment in which loads up the Umbraco form for logging in with OpenID, then i put in a javascript function which automatically submits the form starting the Azure login process.
I have included the code i used below. I know this probably isn't best use and I'm open for other techniques but this has done the job for us.
Below i check that the user is logged in and has a matching member in the back office, if they are logged in and have a member then i set the flag for isLoggedIn to true.
bool isLoggedIn = false;
MemberIdentityUser member = null;
if (Context.User?.Identity?.IsAuthenticated == true)
{
if (_memberManager.IsLoggedIn()) {
member = await _memberManager.FindByNameAsync(User.Identity.Name);
if (member != null)
{
isLoggedIn = true;
}
}
}
Then i use the following code which loads the form if the flag isLoggedIn is false
The i use the following javascript to submit the above form if it exists.
<script type="text/javascript">
$( document ).ready(function() {
var container = $('#loginContainer');
if (container.length) {
var form = container.find('form')[0];
form.submit();
}
});
</script>
I'm fully aware that this is not the best way and i'm sure there must be another way, but due to time frames and client requirements this has done the job for us. I hope it helps
Azure AD Auto login for Members
I am able to add member login for the website with active directory. Right now, I have a button which user has to click and then the azure ad login is taking place. How can I change this to auto login?
So I don't know if you are still having the same issue, but i found a "hack" which allows us to move forward. We have used Azure AD on projects not in Umbraco and I couldn't figure out how to implement this in Umbraco.
So i went with another approach. On the main template page i put a fragment in which loads up the Umbraco form for logging in with OpenID, then i put in a javascript function which automatically submits the form starting the Azure login process.
I have included the code i used below. I know this probably isn't best use and I'm open for other techniques but this has done the job for us.
Below i check that the user is logged in and has a matching member in the back office, if they are logged in and have a member then i set the flag for isLoggedIn to true.
Then i use the following code which loads the form if the flag isLoggedIn is false
The i use the following javascript to submit the above form if it exists.
I'm fully aware that this is not the best way and i'm sure there must be another way, but due to time frames and client requirements this has done the job for us. I hope it helps
is working on a reply...