Password generating

Author Message

Lars Eirik R

Wednesday 16 June 2010 9:51:06 am

Hi.

Is there a utility class i can use in ez API which will allow me to generate passwords once a user registers (it is a custom registration process of mine)

Bertrand Dunogier

Wednesday 16 June 2010 11:38:52 am

Yep, there is. You'll find a few helpful methods in eZUser:

To create a password hash:

eZUser::createHash( $login, $password, eZUser::site(), eZUser::hashType() ) );

Note that the hash type in use should also be stored in the eZUser attribute:

$this->setAttribute( "password_hash", eZUser::createHash( $login, $password, eZUser::site(), eZUser::hashType() ) );
$this->setAttribute( "password_hash_type", eZUser::hashType() );

You can also use the eZUser::validatePassword method in order to make sure the password you'll be using matches the INI settings.

And just in case, there is also an eZUser::createPassword() method if you wanna generate a few.

Bertrand Dunogier
eZ Systems Engineering, Lyon
http://twitter.com/bdunogier
http://gplus.to/BertrandDunogier

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 04:54:43
Script start
Timing: Jan 18 2025 04:54:43
Module start 'layout'
Timing: Jan 18 2025 04:54:43
Module start 'content'
Timing: Jan 18 2025 04:54:44
Module end 'content'
Timing: Jan 18 2025 04:54:44
Script end

Main resources:

Total runtime0.6917 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0045 587.8125152.6094
Module start 'layout' 0.00450.0025 740.421939.4141
Module start 'content' 0.00700.6832 779.8359532.4297
Module end 'content' 0.69030.0014 1,312.26568.1875
Script end 0.6917  1,320.4531 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00300.4351160.0002
Check MTime0.00130.1840160.0001
Mysql Total
Database connection0.00060.088910.0006
Mysqli_queries0.642792.9193540.0119
Looping result0.00050.0719520.0000
Template Total0.661895.720.3309
Template load0.00200.288020.0010
Template processing0.659895.385920.3299
Template load and register function0.00020.022410.0002
states
state_id_array0.00130.193710.0013
state_identifier_array0.00070.106720.0004
Override
Cache load0.00160.2332150.0001
Sytem overhead
Fetch class attribute can translate value0.00050.071420.0002
Fetch class attribute name0.00110.158440.0003
XML
Image XML parsing0.00400.575320.0020
class_abstraction
Instantiating content class attribute0.00000.001240.0000
General
dbfile0.00460.6657220.0002
String conversion0.00000.001040.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
4content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 12
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs