Difference between revisions of "Secret field"
(Updated field page to make structure more consistent to other fields.) |
|||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
− | + | {{fieldtypes}} | |
− | + | ||
== Description == | == 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 == |
+ | * [[Metadata]] | ||
+ | ** [[Id field]] | ||
+ | *** [[Secret field]] | ||
− | + | == Additional Properties == | |
+ | As for [[Id field#Additional_Properties|Id fields]] except for: | ||
+ | {| border="1" cellpadding="3" cellspacing="0" | ||
+ | ! Name !! Default Value !! Required? !! Description !! Notes | ||
+ | |- | ||
+ | | '''repeat_secret''' || <tt>0</tt> || NO || Whether you need to input the secret twice to verify it has been typed in correctly. || | ||
+ | |- | ||
+ | | '''sql_index''' || <tt>0</tt> || NO || Whether field should be index for quicker lookup by the database. || Different from [[Metadata]] default (<tt>1</tt>). | ||
+ | |} | ||
== Required Phrases == | == Required Phrases == | ||
+ | If <tt>repeat_secret => 1</tt> 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:EPrints/MetaField/Namedset|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 [[EPrints_Glossary#Data_object|data object]]'s [[EPrints Glossary#Details tab|Details tab]]. | ||
+ | { | ||
+ | name => 'password', | ||
+ | type => 'secret', | ||
+ | show_in_html => 0, | ||
+ | fromform => \&EPrints::Utils::crypt_password, | ||
+ | } |
Latest revision as of 20:51, 15 April 2023
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 - Recaptcha3 - Relation - Search - Secret - Set - Storable - Subject - Subobject - Text - Time - Timestamp - Url - Uuid
Contents
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, }