![]() |
MeNeedz Password - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: MeNeedz Password (/showthread.php?tid=14421) |
MeNeedz Password - El Forum - 01-05-2009 [eluser]Rick Jolly[/eluser] Iverson, you're taking a spread of 0-100 and turning it into a spread of 1-7. You're returning an integer just the same but you've reduced the precision. IMO, returning a percent makes more sense than returning some arbitrary number between 1 and 7. For example, with a percent you could create a css bar so the user could visualize the security of the password. MeNeedz Password - El Forum - 01-05-2009 [eluser]davidbehler[/eluser] I have update the helper and the guide. Now it no longer returns a string but the actual rating from 0-100. MeNeedz Password - El Forum - 01-05-2009 [eluser]Iverson[/eluser] But what about those who don't want to take the time to create a strength bar? They would still have to go through and define what each strength req't was. MeNeedz Password - El Forum - 01-05-2009 [eluser]davidbehler[/eluser] Ok, I have updated the helper again and added a second parameter to the check function. If it's set to 1 (that's the default) the rating is returned as an integer, else it's returned as a string. I will have to think about a way to internationalize the returned string, maybe i'll really turn it into a library. MeNeedz Password - El Forum - 01-05-2009 [eluser]Iverson[/eluser] [quote author="waldmeister" date="1231209921"]Ok, I have updated the helper again and added a second parameter to the check function. If it's set to 1 (that's the default) the rating is returned as an integer, else it's returned as a string. I will have to think about a way to internationalize the returned string, maybe i'll really turn it into a library.[/quote] Turning it in a lib will give everyone a better option to do what they want to do so you don't have to customize it for everybody ![]() MeNeedz Password - El Forum - 01-23-2009 [eluser]NBrepresent[/eluser] I found this code on a snippet site, I didn't write it and I don't know who did. But maybe it would be a neat addition to your library: Code: <? MeNeedz Password - El Forum - 06-30-2009 [eluser]Pinkiee[/eluser] I have just started looking into CI, and I was writing a prototype and needed something similar to this. Sorry, not be be harsh, but I can't in good conscious let people who don't know any better use this with out knowing how much work it needs. I only had a look at one of the functions. (Password strength) Couple of things you need to look into bud, ctype (in general) ctype_lower ctype_upper ctype_digit ctype_punct Creating an array for "lower case" etc isn't needed in this situation given the scope of the helper. If your not doing anything to a variable then there is no reason to make an assignment $i +=0; // is useless You don't need to loop through the string for every single check your doing, you could loop through it once and do a switch statement and just increment the counters. This is a bit of personal choice, but if you are looping through a string looking for something and you find it, there is no reason to keep looping. Sorry this is all off memory as I was looking at it last night. You can do one loop. Really good concept though, and I think it would be quite a useful helper, when I get to a computer with a winrar on it, I will post a little clean up of the code so you can see the changes I would suggest. MeNeedz Password - El Forum - 07-01-2009 [eluser]davidbehler[/eluser] You are propably right. I haven't looked into that helper for quite some time now, so feel free to clean and enhance it in whatever way you see fit! I'm looking forward to your improvements! MeNeedz Password - El Forum - 07-01-2009 [eluser]Pinkiee[/eluser] The code below is for demonstration only. I am new to CI, and I have not read up on the conventions I also have not tested the code below I am aware that there are still better ways to do this. There is a large lack of comments etc. But I think it displays what I was saying. One for loop, no arrays, no if statements that are not needed. I really do think that this is a great idea, and I would love to see it turned into a library where you can "tweak" the values etc. I might even get around to it myself one day. Code: function check_strength($password) MeNeedz Password - El Forum - 07-02-2009 [eluser]davidbehler[/eluser] Thanks for your contribution! After some minor adjustments I was able to integrate your changes into the helper! I removed the bonus section for now as I'm not sure myself what I was up for ![]() You can get the new version from here: click me |