Jump to content

Secret field

From EPrints Documentation


Description[edit]

This field stores a secret value like a password. This is basically the same as an Id field but the input is masked and not loaded from the database into the input form.

Inheritance[edit]

Additional Properties[edit]

As for Id fields except for:

Name Default Value Required? Description Notes
repeat_secret 0 NO Whether you need to input the secret twice to verify it has been typed in correctly.
sql_index 0 NO Whether field should be index for quicker lookup by the database. Different from Metadata default (1).

Required Phrases[edit]

If repeat_secret => 1 then the additional phrase in the following form is required:

datasetid + "_fieldname_" + fieldname + "_confirm"

E.g.

user_fieldname_password_confirm

Database[edit]

Secret ields are stored in the database as

fieldname VARCHAR(255)

API[edit]

See API page.

Examples[edit]

Most basic example.

{
   name => 'secret', 
   type => 'secret',
}

Crypt the value before it is stored in the database:

{
   name => 'password', 
   type => 'secret',
   fromform => \&EPrints::Utils::crypt_password, 
}

Also do not display the field in the data object's Details tab.

{
   name => 'password', 
   type => 'secret',
   show_in_html => 0,
   fromform => \&EPrints::Utils::crypt_password, 
}