Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jeroen Breuer 4909 posts 12266 karma points MVP 6x admin c-trib
    Feb 02, 2010 @ 11:44
    Jeroen Breuer
    0

    Email as login name

    Hello,

    For a particular website we want to have the email address as the login name. What is the best way to approach this in Umbraco? When a member is created by default you need to enter an email address, but in this situation the email needs to be entered as the name not the email. I'm thinking about creating a dashboard control in which the user only needs to fill in the name field (his email) and a password. It will get a default membertype. Is this a good solution or is there a better way to solve this?

  • Richard Soeteman 4054 posts 12927 karma points MVP 3x
    Feb 02, 2010 @ 12:00
    Richard Soeteman
    1

    Hi Jeroen,

    Sounds like a nice solution. Have done this myself also. I prefer to use the Membership provider though. But in theory that is the same.

    Cheers,

    Richard

  • Jeroen Breuer 4909 posts 12266 karma points MVP 6x admin c-trib
    Feb 08, 2010 @ 14:54
    Jeroen Breuer
    0

    Thanks Richard. You helped me out several times so I also voted for you as the MVP :).

    I ended up creating my own usercontrol in which the user only needs to enter a name, email and password. My code then creates a member with the email as the username. Afterwards the user is redirected to editMember.aspx. I wanted to use the Membership provider for this, but after some trouble I just created my own code. Here is part of it (with some additional business logic):

            public int CreateMember(string name, string loginName, string password, string debtorCode)
            {
                //Create the member.
                Member debtorMember = Member.MakeNew(loginName, DefaultObjects.MemberTypeDebtor, DefaultObjects.AdminUser);

                //Set the password (sql query is executed immediately in Umbraco source code).
                debtorMember.Password = password;

                //Updat the name of the member (sql query is executed immediately in Umbraco source code).
                debtorMember.Text = name;

                //Place the member in the debtor group.
                debtorMember.AddGroup(DefaultObjects.MemberGroupDebtor.Id);

                //Link the member to the debtor.
                InsertMember2Debtor(debtorMember.Id, debtorCode);

                return debtorMember.Id;
            }

  • Richard Soeteman 4054 posts 12927 karma points MVP 3x
    Feb 08, 2010 @ 15:22
    Richard Soeteman
    0

    Hi Jeroen,

    Thanks for your vote! Always nice to help someone with an API question which is my area of expertise.

    See you next week thanks again,

    Richard

     

     

  • Jeroen Breuer 4909 posts 12266 karma points MVP 6x admin c-trib
    Feb 22, 2010 @ 14:36
    Jeroen Breuer
    0

    Hello,

    Now I've got a similar situation again in which I need the e-mail as a login name, but now a lot extra fields also need to be inserted. Instead of creating my own usercontrol at the dashboard can't I override the create button on the member folder in the member section? Instead of the default new popup I would create my own popup in which all the fields can be inserted. This solution seems a lot better than creating my own dashboard control, but is it possible to override the action of member section? Can't I create my own IAction and use it?

    Jeroen

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Feb 22, 2010 @ 14:44
    Dirk De Grave
    0

    Yes, you can, I'd go for the Before/AfterNodeRender (check what type of node...), remove the default Create action, add your own tree action, and your own Create popup dialog. Richard has an example on his blog (for injecting your own tree action). Just shout if you need help building your own custom "create popup dialog"

    Btw, you should be using the .net membership functions instead of directly using the member api...

    Cheers,

    /Dirk

  • Jeroen Breuer 4909 posts 12266 karma points MVP 6x admin c-trib
    Feb 22, 2010 @ 15:17
    Jeroen Breuer
    0

    Thanks for the advice Dirk! I'm going to try it. I already said I had some problems with the .net membership and that's why I'm using the member api directly.

  • Jeroen Breuer 4909 posts 12266 karma points MVP 6x admin c-trib
    Mar 10, 2010 @ 14:59
    Jeroen Breuer
    0

    I've been using the Before/AfterNodeRender event and it has been very useful. The only problem I have with this event is that I can't add any actions to the top node. I've got a user which startnode is not the content node, but a node one level below that (so he can't use the republish button or the recycle bin). So the startnode is a normal node, but in the BaseTree_AfterNodeRender event I can't get to the top node, but only the child nodes. Is there a way I can get to the topnode inside a tree using this event?

  • Jeroen Breuer 4909 posts 12266 karma points MVP 6x admin c-trib
    Mar 11, 2010 @ 16:57
    Jeroen Breuer
    0

    I've got another question. Are the Before/AfterNodeRender events only called while rendering the content nodes? I tried this event on the member section and the event doesn't get hit. Do I need another event for this or is it impossible to change member nodes?

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Mar 11, 2010 @ 17:19
    Dirk De Grave
    0

    Just been checking the code (v4.0.3) -> yes, I think those events are only called for content nodes...

     

    Cheers,

    /Dirk

  • Jeroen Breuer 4909 posts 12266 karma points MVP 6x admin c-trib
    Mar 11, 2010 @ 17:31
    Jeroen Breuer
    0

    Hmm that's a shame. Is there some other way to add extra actions to the member nodes? I've got another solution to use an email as login name. Instead of creating a usercontrol which I use in the dashboard I used this usercontrol to replace the existing create member popup. I did this by changing the following in umbraco\config\create\UI.XML

    <nodeType alias="initmember">
        <header>member</header>
        <usercontrol>/create/CreateMember.ascx</usercontrol>
        <tasks>
          <create assembly="umbraco" type="memberTasks" />
        </tasks>
      </nodeType>

    This used to point to /create/member.ascx, but now it point to my own UserControl CreateMember.ascx in which the member must use an e-mail as a login name. This solved my problem, but I'd still like to add extra actions instead of replacing existing ones.

  • Jeroen Breuer 4909 posts 12266 karma points MVP 6x admin c-trib
    Mar 12, 2010 @ 09:03
    Jeroen Breuer
    0

    I've created a workitem on codeplex in which I mention the events only get hit in the content section. Please vote for this issue: http://umbraco.codeplex.com/WorkItem/View.aspx?WorkItemId=26461

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies