|
|
 Rank: Addict
Joined: 7/19/2006 Posts: 820 Location: Benfleet, Essex, UK
|
Hi Skiltz I haven't had time to look at this yet, but let me know how you get on when you look into this. I would be interested on your results. Warren Warren Buckley an Umbraco MVP 08-09 & level 1 certified developer
|
|
Rank: Devotee
Joined: 1/11/2007 Posts: 57
|
Hi All, just while on the subject of membershipProviders in V4, I came across something strange today. I was trying to get YAF to use a V4 Membership Provider, and wasn't terribly successful, got a "Provider Application Name too long" exception from the Umbraco provider http://www.codeplex.com/umbraco/SourceControl/FileView.aspx?itemId=448962&changeSetId=37848... The code for this looks strange to me - but I could be missing something out - why is the null check in place? Should this get logged in codeplex? Cheers, Chris
|
|
Rank: Devotee
Joined: 1/11/2007 Posts: 57
|
|
|
Rank: Newbie
Joined: 7/17/2008 Posts: 13 Location: Prague
|
Adz wrote:So here are the steps which I have followed: 1) Create a member group in the Membership section of Umbraco (e.g. "RegisteredMember") 2) Create a member type in the Membership section of Umbraco (e.g. "MyMemberType") 3) Edit web.config so that the defaultMemberTypeAlias="MyMemberType" 4) In the content section, right click on a node and set "Public Access" to allow the "RegisteredMember" group 5) Create a member in the Membership section, of type "MyMemberType" 6) Create the password 7) Assign the new member to the "RegisteredMember" group You should now have a member who can login to the site. For the benefit of other readers of this thread:- See also http://en.wikibooks.org/wiki/Umbraco/Samples_and_Articles/Protecting_Documents and http://hartvig.com/screencasts/members.htmThe next problem is, if you allow members to register themselves (e.g. like on a Forum) - how do they automatically get assigned the "RegisteredMember" group ...? Hi, I have followed these steps (I hope), even watched the screencast, but still my members do not get access. I'm using the current V4 Beta 1 and if a member created in this way logs in through MemberControls, the protected page still redirects him to NeedLogin page, acting as he is not logged at all (it doesn't ever give the AccessDenied page which would mean a bad group assignment). Can it be a problem with an incorrect MemberType? I've triple-checked it in the web.config, registration macro and even created them manually. Btw why is it important to update it in the web.config? I'm a umb newbie, so maybe there is a very simple solution. Thanks in advance.
|
|
 Rank: Aficionado
Joined: 6/5/2008 Posts: 148 Location: United Kingdom
|
Are you using the "old" Umbraco membership controls, or the "new" standard ASP.NET login controls (<asp:Login />)?
Adam Perry ( blog, twitter), developing Umbraco based websites and applications for ConnectDigital.
|
|
Rank: Newbie
Joined: 7/17/2008 Posts: 13 Location: Prague
|
Thanks for the hint. Probably the old ones, though I updated them upon porting to V4 - but still they are Umbraco macros. So the solution is not to use these macros and program it using ASP.NET manually? Or are there any pre-done controls to be used in ASP.NET?
|
|
 Rank: Aficionado
Joined: 6/5/2008 Posts: 148 Location: United Kingdom
|
The controls you require are standard in ASP.NET. So you don't need to use a Macro. Instead you can enter the following into your Template: Code: <asp:Login ID="Login1" runat="server"> </asp:Login>
There is plenty more information on MSDN, try here: http://msdn.microsoft.com/en-us/library/ms178329.aspxAdz
Adam Perry ( blog, twitter), developing Umbraco based websites and applications for ConnectDigital.
|
|
Rank: Newbie
Joined: 7/17/2008 Posts: 13 Location: Prague
|
Thank you kindly, this is of great help!
|
|
 Rank: Aficionado
Joined: 6/5/2008 Posts: 148 Location: United Kingdom
|
No problem - let us know how you get on! - Adz
Adam Perry ( blog, twitter), developing Umbraco based websites and applications for ConnectDigital.
|
|
 Rank: Umbracoholic
Joined: 9/27/2007 Posts: 1,123 Location: Belgium
|
Hi, Atm, it's possible to add any number of users with the same name (Ok, can live with that, it's possible in reality as well), but I could also create 2 members with the same login? Are there others that have had the same issue or can confirm this? If so, I'll add this as a work item on Codeplex! Have used the latest change set 38590 from today. Other issue, might be related but not sure if it's due to my setup... I've created a user sign up page (using standard asp.net controls). I was able to register, but going to the admin backend, I couldn't change the member groups the user belongs to (Ie, had a Forum users group, but couldn't add that group to list of groups for that member). Well, I was able to add it to the right side listbox, but saving didn't have any effect. As a matter of fact, it didn't do anything at all? Any feedback is welcome! Regards, /Dirk
level 1 & 2 certified - umbraco MVP 2008/2009 - umbraco blog at netaddicts.be - working on an integrated forum4umbraco
|
|
 Rank: Devotee
Joined: 10/19/2007 Posts: 59 Location: Glasgow, Scotland
|
Hi all,
I'm using the latest v4 nightly build from Wednesday 17th September. The problem I'm having is trying to protect the members content area of the site (right click -> Public Access).
I have one Registered Members group on the site, which I select and put on the right hand side in the Public Access dialog box, so that members of this group should have access to this area of the site. I click Update to save the changes. My members can't log in. I go back and check the Public Access dialog for the members area again, and the group is back on the left hand side, i.e. unselected.
This means that my users can never get access to the members' area even though they are members of the correct group.
Any ideas?
Cheers,
David
David Conlisk - Umbraco level 2 certified web-garden.co.uk
|
|
 Rank: Devotee
Joined: 10/19/2007 Posts: 59 Location: Glasgow, Scotland
|
Dirk wrote: ...
I've created a user sign up page (using standard asp.net controls). I was able to register, but going to the admin backend, I couldn't change the member groups the user belongs to (Ie, had a Forum users group, but couldn't add that group to list of groups for that member). Well, I was able to add it to the right side listbox, but saving didn't have any effect. As a matter of fact, it didn't do anything at all?
...
This is also an issue for me. When I create a member, I use Member.AddGroup() to add the newly created member to the Registered Members group. This works fine. However, if I create a member through the Umbraco admin and attempt to add a group, it fails (when the page refreshes after clicking save, the group is back on the left, i.e. unselected). This is the same as the problem I'm having in the Public Access dialog box. Any ideas appreciated!
David Conlisk - Umbraco level 2 certified web-garden.co.uk
|
|
 Rank: Devotee
Joined: 10/19/2007 Posts: 59 Location: Glasgow, Scotland
|
Okay, I got this sorted - Dirk this applies for you too.
I don't understand what the problem was, but going back to my previous "latest" codebase has done the trick. I backed up everything first (obviously!) then I copied all of the Umbraco folders and overwrote my installations with the files that I downloaded from Monday 8th September from nightly.umbraco.org.
Now I can set the Member groups in the Public Access dialog correctly, but also manipulate a member's groups and (another problem I had discovered) create a new macro to wrap a new .NET control in. They all seem to have stemmed from the same bug perhaps? So it seems to have crept in some time between September 8th and September 17th.
Hope that helps,
David
David Conlisk - Umbraco level 2 certified web-garden.co.uk
|
|
 Rank: Fanatic
Joined: 7/21/2006 Posts: 315 Location: Salerno - Italy
|
Hi, I wrote this function into .NET action handler of Submit Button on Create Wizard User : protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e) { Member m = Member.MakeNew(CreateUserWizard1.UserName, CreateUserWizard1.Email, MemberType.GetByAlias("A"), new User(0)); m.LoginName = CreateUserWizard1.UserName.ToString(); m.Password = CreateUserWizard1.Password.ToString(); MemberGroup Group = MemberGroup.GetByName("A"); //if (Group != null) // m.AddGroup(Group.Id); m.AddGroup(1132); } After push button, I had this error: Quote: Errore server nell'applicazione '/'. No node exists with id '0' Descrizione: Eccezione non gestita durante l'esecuzione della richiesta Web corrente. Per ulteriori informazioni sull'errore e sul suo punto di origine nel codice, vedere l'analisi dello stack.
Dettagli eccezione: System.ArgumentException: No node exists with id '0'
Why? Then .NET AddRoles is used to add new member to "Member Groups". And Which .NET function must be used to add it to Member Type? Thanks Red Consulting s.a.s - Umbraco from v1.0
|
|
 Rank: Fanatic
Joined: 7/21/2006 Posts: 315 Location: Salerno - Italy
|
Deirh wrote:Adz wrote:So here are the steps which I have followed: 1) Create a member group in the Membership section of Umbraco (e.g. "RegisteredMember") 2) Create a member type in the Membership section of Umbraco (e.g. "MyMemberType") 3) Edit web.config so that the defaultMemberTypeAlias="MyMemberType" 4) In the content section, right click on a node and set "Public Access" to allow the "RegisteredMember" group 5) Create a member in the Membership section, of type "MyMemberType" 6) Create the password 7) Assign the new member to the "RegisteredMember" group You should now have a member who can login to the site. For the benefit of other readers of this thread:- See also http://en.wikibooks.org/wiki/Umbraco/Samples_and_Articles/Protecting_Documents and http://hartvig.com/screencasts/members.htmThe next problem is, if you allow members to register themselves (e.g. like on a Forum) - how do they automatically get assigned the "RegisteredMember" group ...? Hi, I have followed these steps (I hope), even watched the screencast, but still my members do not get access. I'm using the current V4 Beta 1 and if a member created in this way logs in through MemberControls, the protected page still redirects him to NeedLogin page, acting as he is not logged at all (it doesn't ever give the AccessDenied page which would mean a bad group assignment). Can it be a problem with an incorrect MemberType? I've triple-checked it in the web.config, registration macro and even created them manually. Btw why is it important to update it in the web.config? I'm a umb newbie, so maybe there is a very simple solution. Thanks in advance. So, with this setup is not be made a general usercontrol. Red Consulting s.a.s - Umbraco from v1.0
|
|
 Rank: Fanatic
Joined: 7/21/2006 Posts: 315 Location: Salerno - Italy
|
Ig_p118 wrote:Hi, I wrote this function into .NET action handler of Submit Button on Create Wizard User : protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e) { Member m = Member.MakeNew(CreateUserWizard1.UserName, CreateUserWizard1.Email, MemberType.GetByAlias("A"), new User(0)); m.LoginName = CreateUserWizard1.UserName.ToString(); m.Password = CreateUserWizard1.Password.ToString(); MemberGroup Group = MemberGroup.GetByName("A"); //if (Group != null) // m.AddGroup(Group.Id); m.AddGroup(1132); } After push button, I had this error: Quote: Errore server nell'applicazione '/'. No node exists with id '0' Descrizione: Eccezione non gestita durante l'esecuzione della richiesta Web corrente. Per ulteriori informazioni sull'errore e sul suo punto di origine nel codice, vedere l'analisi dello stack.
Dettagli eccezione: System.ArgumentException: No node exists with id '0'
Why? Then .NET AddRoles is used to add new member to "Member Groups". And Which .NET function must be used to add it to Member Type? Thanks No reply? Red Consulting s.a.s - Umbraco from v1.0
|
|
 Rank: Fanatic
Joined: 7/21/2006 Posts: 315 Location: Salerno - Italy
|
Hi, I suppose, if we use .NET Standard Control then is not possibile ,at runtime, to choose which member type to assign because in web.config we must setup defaultMemberTypeAlias var. Thus we made a custom wizard without .NET Control? I confirm that "member.AddGroup(MemberGroup.GetByName("Pilots").Id)" don't works. Bye Red Consulting s.a.s - Umbraco from v1.0
|
|
 Rank: Umbracoholic
Joined: 9/27/2007 Posts: 1,123 Location: Belgium
|
Ig_p118 wrote:I confirm that "member.AddGroup(MemberGroup.GetByName("Pilots").Id)" don't works. Hi Iq_p118, It does work, so I guess you must have made a mistake. I've done it on several occasions, and no issues whatsoever. Did you enable the umbraco role manager? Are you using the correct name for the member group (it's the name, not the alias)? Regards, /Dirk
level 1 & 2 certified - umbraco MVP 2008/2009 - umbraco blog at netaddicts.be - working on an integrated forum4umbraco
|
|
 Rank: Fanatic
Joined: 7/21/2006 Posts: 315 Location: Salerno - Italy
|
Hi, I'm using group name ( MemberGroup.GetByName("Pilots").Id return correct ID ) but into Umbraco backend , I see that user is not in that group because the right column of [memberGroups] is empty. Also, my problem is: How Can I assign to user ( using .NET control ) a different MemberType from those specified in web.config  ? My Code ( It create two user with same name because there is MakeNew  ): Quote:
Protected Sub CreateUserWizard1_CreatedUser(ByVal sender As Object, ByVal e As EventArgs) Handles CreateUserWizard1.CreatedUser Dim user As MembershipUser Dim _member As Member
Dim member_type As MemberType = MemberType.GetByAlias("Pilot")
' Member m = Member.MakeNew(CreateUserWizard1.UserName, CreateUserWizard1.Email, MemberType.GetByAlias("Pilot"), new User(0)); ' m.LoginName = CreateUserWizard1.UserName.ToString(); ' m.Password = CreateUserWizard1.Password.ToString();
user = Membership.GetUser(Me.CreateUserWizard1.UserName) _member = Member.MakeNew(Me.CreateUserWizard1.UserName, member_type, New User(CInt(user.ProviderUserKey)))
'_member = New Member(CInt(user.ProviderUserKey))
_member.getProperty("flighthours").Value = "0" _member.getProperty("grade").Value = "Nessuno" _member.AddGroup(MemberGroup.GetByName("Pilots").Id)
'for adding to member group
'Roles.AddUserToRole(CreateUserWizard1.UserName, "Pilots")
_member.Save()
End Sub
My web.config is: Quote: <!-- Membership Provider --> <membership defaultProvider="UmbracoMembershipProvider" userIsOnlineTimeWindow="15"> <providers> <clear /> <add name="UmbracoMembershipProvider" type="umbraco.providers.members.UmbracoMembershipProvider" enablePasswordRetrieval="true" enablePasswordReset="false" requiresQuestionAndAnswer="false" defaultMemberTypeAlias="testmember" /> <add name="UsersMembershipProvider" type="umbraco.providers.UsersMembershipProvider" enablePasswordRetrieval="false" enablePasswordReset="false" requiresQuestionAndAnswer="false" /> </providers> </membership>
<roleManager enabled="true" defaultProvider="UmbracoRoleProvider"> <providers> <clear /> <add name="UmbracoRoleProvider" type="umbraco.providers.members.UmbracoRoleProvider" /> </providers> </roleManager>
and umbraco.settings <providers> <users> <!-- if you wish to use your own membershipprovider for authenticating to the umbraco back office --> <!-- specify it here (remember to add it to the web.config as well) --> <DefaultBackofficeProvider>UsersMembershipProvider</DefaultBackofficeProvider> </users> </providers> I'm crazy on it.... Bye Red Consulting s.a.s - Umbraco from v1.0
|
|
 Rank: Umbracoholic
Joined: 9/27/2007 Posts: 1,123 Location: Belgium
|
Hi, Here's a code snippet I use on a v4 site I've been developing the last weeks: Code: void CreateUmbracoMember_CreatedUser(object sender, EventArgs e) {
umbraco.cms.businesslogic.member.Member registeredMember = umbraco.cms.businesslogic.member.Member.GetMemberFromLoginName(UmbracoMemberRegistration.UserName);
if (registeredMember != null && registeredMember.Id > 0) {
try { //Member profile update based on info found in registration wizard MemberProfileUpdate(registeredMember);
RegistrationPanel.Visible = false; ***.Visible = true;
} catch { Log.Add(LogTypes.Custom, User.GetUser(0), Node.GetCurrent().Id, new StringBuilder().Append("Error while persisting member frofile info for member '").Append(registeredMember.Text).Append("' (").Append(registeredMember.Id).Append(")!").ToString()); } } }
private void MemberProfileUpdate(umbraco.cms.businesslogic.member.Member member) { try { //Get profile info from regsitration wizard TextBox firstNameTextBox = (TextBox)UmbracoMemberRegistration.CreateUserStep.ContentTemplateContainer.FindControl("FirstName"); TextBox lastNameTextBox = (TextBox)UmbracoMemberRegistration.CreateUserStep.ContentTemplateContainer.FindControl("LastName");
//Member profile update member.getProperty("firstname").Value = !string.IsNullOrEmpty(firstNameTextBox.Text) ? firstNameTextBox.Text : string.Empty; member.getProperty("lastname").Value = !string.IsNullOrEmpty(lastNameTextBox.Text) ? lastNameTextBox.Text : string.Empty;
//Set user friendly name for member node in admin backend string text = string.Empty; if (firstNameTextBox != null && lastNameTextBox != null) text = firstNameTextBox.Text + " " + lastNameTextBox.Text;
//E-mail is set to username as e-mail is used as username member.Email = member.LoginName;
//Set user friendly name in backend if (!string.IsNullOrEmpty(text)) member.Text = text;
member.Save();
} catch { } } I've removed some parts... for prying yes ;) but I think you get my point here. Nothing fancy, it just works as expected. Member will be of member type as specified in web.config, so there's no need to specify this in code. I've noticed a small difference in your roleManager config in web.config (no applicationName attribute in yours). Not sure if that would make a difference though Here's mine: Code: <roleManager enabled="true" defaultProvider="UmbracoRoleProvider"> <providers> <clear /> <add name="UmbracoRoleProvider" type="umbraco.providers.members.UmbracoRoleProvider" applicationName="umbraco" /> </providers> </roleManager>
Hope this helps. Regards, /Dirk
level 1 & 2 certified - umbraco MVP 2008/2009 - umbraco blog at netaddicts.be - working on an integrated forum4umbraco
|
|
|
Guest |