hey! I have just started using Umbraco and so far I love it, but still.. I am abit noobish with it. Well, the problem is that when I have created the Register-macro.. (it works). I do NOT want to become logged in as the user that I have registered.. So if Im logged in as a user "admin" I want that user to be able to create other users without logging in as them.. I would really love some help! :)
I am not sure what's in the macro, but I know how to do it via regular code.
For Member registration you use the new (ok, not so new) MembershipHelper. (It's available as @Members in views and as Members in Controllers).
A member is created by creating an instance of RegisterModel:
RegisterModel data = Members.CreateRegistrationModel("Member");
data.Email = model.Email;
data.LoginOnSuccess = true; // set this to false
data.Name = model.FirstName + " " + model.LastName;
...
This model is passed to the RegisterMember method:
MembershipCreateStatus status;
MembershipUser user = Members.RegisterMember(data, out status, true); // set third param to false
The third param here (which is true in my example) is logMemberIn. By setting this to false it doesn't log you in after creating the member. There's also a data.LoginOnSuccess in the first code snippet - better set this to false too, I am not sure why there are two places where you can set it.
Hope this helps!
And if it helps, would be great as you would mark it as an answer :)
Do not want to become logged in after register.
hey! I have just started using Umbraco and so far I love it, but still.. I am abit noobish with it. Well, the problem is that when I have created the Register-macro.. (it works). I do NOT want to become logged in as the user that I have registered.. So if Im logged in as a user "admin" I want that user to be able to create other users without logging in as them.. I would really love some help! :)
thanks
/Daniel
I am not sure what's in the macro, but I know how to do it via regular code.
For Member registration you use the new (ok, not so new)
MembershipHelper
. (It's available as@Members
in views and asMembers
in Controllers).A member is created by creating an instance of
RegisterModel
:This model is passed to the
RegisterMember
method:The third param here (which is
true
in my example) islogMemberIn
. By setting this to false it doesn't log you in after creating the member. There's also adata.LoginOnSuccess
in the first code snippet - better set this to false too, I am not sure why there are two places where you can set it.Hope this helps! And if it helps, would be great as you would mark it as an answer :)
is working on a reply...