I have used the Java API build a small program to read a CSV file and set usernames and passwords. This would still involve creating the CSV file. ColdFusion runs on top of Java on the server so you could just write a Java class that can be called right in ColdFusion and automate the entire process. User fills out your ColdFusion form, ColdFusion verifies the user, ColdFusion passes the username and /or password on to the Java file. The Java class does its thing and changes the password and passes back any error message. I haven't worked on this for a year and a half so my code uses a slightly out of date version of the API. If you can find a Java programmer they could figure out the Google API and how Java can integrate in with ColdFusion. George
On Thu, Feb 24, 2011 at 4:38 PM, Emmanuel Dreux <[email protected]> wrote: > Hi, > Here is a piece of code coming from a project I'm currently working on. > It shows how to generate a hash( md5 or sha-1) and change the password of > the user on the google system. > It's a C# code, you should be able to easily port it to the language of your > choice. > > /// <summary> > /// Login in Google System > /// </summary> > internal void Login() > { > service = new AppsService(_Domain, _AdministratorEmail, > _AdministratorPassword); > if (service == null) > throw new Exception("Login Failed"); > } > /// <summary> > /// Set ¨Password Hashing function > /// </summary> > /// <param name="hashFunction"></param> > internal void SetHashFunction(string hashFunction) > { > _HashFunction = hashFunction.ToLower(); > } > /// <summary> > /// Change Password of user account > /// </summary> > /// <param name="userName"></param> > /// <param name="password"></param> > internal void SetPassword(string userName,string password) > { > //Search the user > UserEntry entry = service.RetrieveUser(userName); > //change the pasword > entry.Login.Password = Hash(password); > entry.Login.HashFunctionName = _HashFunction; > //save modification > entry.Update(); > } > private string Hash(string password) > { > if (string.Compare(_HashFunction, "md5") == 0) > { > return CalculateMD5Hash(password); > } > if (string.Compare(_HashFunction, "sha1") == 0) > { > return CalculateSHA1Hash(password); > } > return string.Empty; > } > /// <summary> > /// Hash password using MD5 > /// </summary> > /// <param name="input"></param> > /// <returns></returns> > private string CalculateMD5Hash(string password) > { > MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider(); > byte[] bs = System.Text.Encoding.UTF8.GetBytes(password); > bs = md5.ComputeHash(bs); > System.Text.StringBuilder s = new System.Text.StringBuilder(); > foreach (byte b in bs) > { > s.Append(b.ToString("x2").ToLower()); > } > return s.ToString(); > } > /// <summary> > /// Hash password using MD5 > /// </summary> > /// <param name="input"></param> > /// <returns></returns> > private string CalculateSHA1Hash(string password) > { > SHA1CryptoServiceProvider sha1 = new > SHA1CryptoServiceProvider(); > byte[] bs = System.Text.Encoding.UTF8.GetBytes(password); > bs = sha1.ComputeHash(bs); > System.Text.StringBuilder s = new System.Text.StringBuilder(); > foreach (byte b in bs) > { > s.Append(b.ToString("x2").ToLower()); > } > return s.ToString(); > } > Regards, > Emmanuel Dreux > http://www.bcpsoft.fr > > > 2011/2/24 Miq <[email protected]> >> >> Right now when one of my users forgets their password I make them turn in >> a reset request that verifies they are who they say they are. Once that >> request completes I save the username and new password (new password that I >> specify) into a SQL table. Our admins use a webpage that queries the >> database for resets and we perform the resets manually. >> >> What I am wondering is if there is a way to use an API to reset passwords >> given a username and new password from a text file or csv so I can automate >> the process. I can easily export the existing reset requests on an hourly >> basis into a csv file, I just don't know how to use an API to use my file >> and reset the passwords. I currently use Coldfusion 9 to host the reset >> request page and to write to the SQL backend; so if there is an easier way >> to just integrate the API into the Coldfusion form then that is even better. >> >> Just as fair warning I have never really used APIs before so please assume >> I have no idea what you are talking about if you have a suggestion. >> >> Thanks >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Google Apps Domain Information and Management APIs" group. >> To post to this group, send email to >> [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/google-apps-mgmt-apis?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "Google Apps Domain Information and Management APIs" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-apps-mgmt-apis?hl=en. > -- George Adams Hay River Software LLC N14397 380th St. Ridgeland WI 54763 715 205-7555 715 455-1652 -- You received this message because you are subscribed to the Google Groups "Google Apps Domain Information and Management APIs" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-apps-mgmt-apis?hl=en.
