Secret field

From EPrints Documentation
Jump to: navigation, search

EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects


Metadata Fields: Arclanguage - Base64 - Bigint - Boolean - Compound - Counter - Dataobjref - Date - Decimal - Email - Fields - Float - Id - Idci - Image - Int - Itemref - Keywords - Langid - Longtext - Longtext_counter - Multilang - Multipart - Name - Namedset - Pagerange - Recaptcha - Relation - Search - Secret - Set - Storable - Subject - Subobject - Text - Time - Timestamp - Url - Uuid


Description

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

Additional Properties

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

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

Secret ields are stored in the database as

fieldname VARCHAR(255)

API

See API page.

Examples

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, 
}