mierlp Posted April 25, 2013 Posted April 25, 2013 hi For my applications the user needs to create a account. When the account is created he receives a mail with a unique generated code like : -194539324982423641254025935501407370742 Now the user has to login and when it's the first time he has to paste the code into a edit field to test if it's the right code. But...like the most forums i would like to have a url with this code and when the user clicks the link in his mail the account must be set to active. How can this be done and how/where to check if this code belong to the right user Regards Peter Quote
Peter Gregory Posted April 25, 2013 Posted April 25, 2013 Hi, if the url has the format www.mywebsite.com/?code=194539324982423641254025935501407370742 you can check the value in your code with myvariable:=UniApplication.Parameters.Values['code']; hope this helps Peter Quote
cristianotestai Posted April 26, 2013 Posted April 26, 2013 hi For my applications the user needs to create a account. When the account is created he receives a mail with a unique generated code like : -194539324982423641254025935501407370742 Now the user has to login and when it's the first time he has to paste the code into a edit field to test if it's the right code. But...like the most forums i would like to have a url with this code and when the user clicks the link in his mail the account must be set to active. How can this be done and how/where to check if this code belong to the right user Regards Peter Hi Peter, Below I show the procedures that I use in my project, where for example I sent an email to activate your user account on the site. 1: I saved a key (TGUID) to identify the user token in the Users table in a field called Token. 2: We send the activation email account to the User, the body of the email I add the reference to the link as below: To activate your account click on the link: '<a href="http://myapp.com/?et=AU&t=' + sToken +'">' + 'http://myapp.com/?et=AU&t=' + sToken + '</a>'; Where the parameter et = AU reports that the type of email is User Activation, the parameter t contains the Token(through sToken variable) of the User that was saved in the database. When the User clicks on the link will load the application and in the OnShow(MainForm) event I do check if there are parameters to be validated: TfmHome.UniFormShow procedure (Sender: TObject); begin if (UniApplication.Parameters.Values ['t'] = 'AU') then / /Checks if the parameter t (emailtype) exists and is for user activation(AU). begin //Validates Token (checks whether the content parameter t) if (UniApplication.Parameters.Values ['t'] <>'') then begin //Now with the GetTokenInfo function below, I check if the value of the parameter t is valid. The GetTokenInfo receives the token sent and validates the information in the database. if dmSessionModule.SystemObj.GetTokenInfo (UniApplication.Parameters.Values ['t']) = True then begin //Here I show the screen to the User confirm your user and password to activate the user. ... ... end; end; end; end; 2 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.