Commit aa86c5cfded0491eb77ebe770c364d4b90790930
1 parent
c6605b53
add password_field
Showing
1 changed file
with
12 additions
and
5 deletions
Show diff stats
types/model/fields.anubis
| ... | ... | @@ -135,7 +135,7 @@ public type HK_Model_Field: |
| 135 | 135 | foreign_key (HK_App_Name app_name, String table_name), // foreign key to 'id' in another (or same) table and column_name for choice selector. |
| 136 | 136 | integer_field (HK_Int_Choices choices), // integer of arbitrary size |
| 137 | 137 | char_field (HK_Text_Choices choices, Int size), // text of maximal size 'size' (number of characters) |
| 138 | - //password_field(Int min_size), | |
| 138 | + password_field(Int min_size), // the password field doesn't show the password string or store it in hashed version into database | |
| 139 | 139 | text_field. // text of variable size |
| 140 | 140 | |
| 141 | 141 | //default initialization |
| ... | ... | @@ -220,11 +220,15 @@ public define Message |
| 220 | 220 | //TODO add choices if need |
| 221 | 221 | forget(add_string(hk_model_field_message, "type", "integer_field")), |
| 222 | 222 | |
| 223 | - char_field (choices, size) then // text of maximal size 'size' (number of characters) | |
| 223 | + char_field (choices, size) then // text of maximal size 'size' (number of characters) | |
| 224 | 224 | //TODO add choices if need |
| 225 | 225 | forget(add_string(hk_model_field_message, "type", "char_field")); |
| 226 | - forget(add_int32(hk_model_field_message, "size", truncate_to_Word32(size))), | |
| 227 | - | |
| 226 | + forget(add_int32(hk_model_field_message, "size", truncate_to_Word32(size))), | |
| 227 | + | |
| 228 | + password_field(size) then | |
| 229 | + forget(add_string(hk_model_field_message, "type", "password_field")); | |
| 230 | + forget(add_int32(hk_model_field_message, "size", truncate_to_Word32(size))), | |
| 231 | + | |
| 228 | 232 | text_field then // text of variable size |
| 229 | 233 | forget(add_string(hk_model_field_message, "type", "text_field")) |
| 230 | 234 | |
| ... | ... | @@ -251,8 +255,11 @@ define Maybe(HK_Model_Field) |
| 251 | 255 | }}} |
| 252 | 256 | else if type = "integer_field" then success(integer_field) |
| 253 | 257 | else if type = "char_field" then |
| 254 | - if find_int32(hk_model_field_message, "size") is {failure then failure, success(w32_size) then | |
| 258 | + if find_int32(hk_model_field_message, "size") is {failure then failure, success(w32_size) then | |
| 255 | 259 | success(char_field(to_Int(w32_size)))} |
| 260 | + else if type = "password_field" then | |
| 261 | + if find_int32(hk_model_field_message, "size") is {failure then failure, success(w32_size) then | |
| 262 | + success(password_field(to_Int(w32_size)))} | |
| 256 | 263 | else if type = "text_field" then success(text_field) |
| 257 | 264 | else failure |
| 258 | 265 | . | ... | ... |