Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Autogenerate password and send to newly created userAutogenerate password and send to newly created user
Previous
 
Next
New Post
1/5/2011 9:12 AM
 
hi there,

I'm working on my own registration module for users, I was wondering is there an way of sending a generated password to the user wich is created

I tried, but it doesnt do what I want. I dont want to enter anything. since the username = the email
and when I press add new user I want to autogenerated password to be send to the user

DotNetNuke.Services.Mail.Mail.SendMail(From.Text.Replace(vbCrLf, ";"), To.Text.Replace(vbCrLf, ";"), "", strMailSubject, strMailBody, "", "Html", "", "", "username", "password")
 
New Post
1/5/2011 3:41 PM
 
The snipped you are talking about is asking for e-mail username/password and not actually the user password. Can you share the rest of your code?

-Mitchel Sellers
Microsoft MVP, ASPInsider, DNN MVP
CEO/Director of Development - IowaComputerGurus Inc.
LinkedIn Profile

Visit mitchelsellers.com for my mostly DNN Blog and support forum.

Visit IowaComputerGurus.com for free DNN Modules, DNN Performance Tips, DNN Consulting Quotes, and DNN Technical Support Services
 
New Post
1/6/2011 8:10 AM
 
Since I still havent figured out how to fix the email thing, I didnt put the code in yet.
Second, i'm getting an error when I try to add an user with the same username. Instead of showing an message lbl.text="GeT_SoOpA" The INSERT statement conflicted with the FOREIGN KEY constraint "FK_UserProfile_Users". The conflict occurred in database "dnn2", table "dbo.Users", column 'UserID'. The statement has been terminated.

I tried it with 

1. DotNetNuke.Security.Membership.UserCreateStatus.DuplicateUserName.ToString()
2. DotNetNuke.Security.Membership.UserCreateStatus.UsernameAlreadyExists.ToString()

but non of these seem to work any ideas?

My code:


Dim UserInfo As New UserInfo()
        UserInfo.PortalID = Me.PortalId
        UserInfo.FirstName = textbox.Text.ToString()
        UserInfo.LastName = textbox.Text.ToString()
        UserInfo.Username = textbox.Text.ToString()
        UserInfo.Email = textbox.Text.ToString()

        UserInfo.DisplayName = textbox.Text.ToString() + " " + textbox.Text.ToString() + " " + textbox.Text.ToString()
        UserInfo.IsSuperUser = False

        UserInfo.Membership.Password = UserController.GeneratePassword(12).ToString
        lbl.Text = UserInfo.Membership.Password

        'this should be appropriate portal id if you want to support multi portal registrations

        Dim status As DotNetNuke.Security.Membership.UserCreateStatus = DotNetNuke.Entities.Users.UserController.CreateUser(obj)
        'TODO User Created Successfully - update your profile properties here

        If cbMan.Checked = True Then
            UserInfo.Profile.SetProfileProperty("pp", "string")
        Else
            UserInfo.Profile.SetProfileProperty("pp", "string")
        End If

        UserInfo.Profile.SetProfileProperty("Firstname", textbox.Text.ToString())
        UserInfo.Profile.SetProfileProperty("Lastname", textbox.Text.ToString())
        UserInfo.Profile.SetProfileProperty("Company", pp.ToString())
        UserInfo.Profile.SetProfileProperty("pp", textbox.Text.ToString())
        UserInfo.Profile.SetProfileProperty("pp", textbox.Text.ToString())

        ' UserController.UpdateUser(Me.PortalId, obj)
        DotNetNuke.Entities.Profile.ProfileController.UpdateUserProfile(obj)

        If status = DotNetNuke.Security.Membership.UserCreateStatus.Success Then

            label.Text = "GeT_AiGhT"

        Else

            label.Text = "GeT_SoOpA"


        End If
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Autogenerate password and send to newly created userAutogenerate password and send to newly created user


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out