Copied to clipboard

Flag this post as spam?

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


  • Jesper Ordrup 1019 posts 1528 karma points MVP
    Dec 04, 2020 @ 23:09
    Jesper Ordrup
    0

    Using API to create users and send invite

    I'm sure it's possible but I can't find it in the Umbraco 8 API?

    /Jesper

  • Huw Reddick 1736 posts 6076 karma points MVP c-trib
    Dec 04, 2020 @ 23:16
    Huw Reddick
    0

    you can create a user like this

            RegisterModel regModel = RegisterModel.CreateModel();
            regModel.Username = model.siemail;
            regModel.Email = model.siemail;
            regModel.Password = model.sipassword;
            regModel.Name = model.firstName + " " + model.lastName;
    
            MembershipCreateStatus regStatus = new MembershipCreateStatus();
    
            MembershipUser user = Members.RegisterMember(regModel, out regStatus, false);
            if (regStatus != MembershipCreateStatus.Success)
            {
                throw new System.Exception("Unable to register user: " + regStatus);
            }
    
  • Jesper Ordrup 1019 posts 1528 karma points MVP
    Dec 04, 2020 @ 23:42
    Jesper Ordrup
    0

    Thank you. I might have approached this wrong. I just went to the docs that describes how to create user using userservice. That works too.

    My problem is that I can't find how to send the invite - your approach doesn't allow this either. Correct ?

  • Huw Reddick 1736 posts 6076 karma points MVP c-trib
    Dec 05, 2020 @ 08:04
    Huw Reddick
    0

    at what stage do you want to send an invite? Do you want the invite to have some sort of validation link. If you could explain the flow that you require I can explain what you need to do.

    Our registration process involves an email confirmation step so it is quite straight forward to do.

  • Jesper Ordrup 1019 posts 1528 karma points MVP
    Dec 06, 2020 @ 12:53
    Jesper Ordrup
    0

    Consider the flow in Umbraco UI where you in the usersection can either invite or create a user.

    I thought that the invite user feature was available via Api (send invitation and accept invitation)

Please Sign in or register to post replies

Write your reply to:

Draft