diff options
author | Yorhel <git@yorhel.nl> | 2019-10-02 14:21:12 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2019-10-02 14:21:15 +0200 |
commit | 7d8274f0332b1c92825988c6393037bf7eb12af3 (patch) | |
tree | cdcc33c92f764b3199fffeef990d71e6085dff06 /lib/VNWeb/Elm.pm | |
parent | 1a9a4b4bdb8f3b6d7d0ad12032c17c44a8287a09 (diff) |
v2rw: Convert user preferences form
And add a small 'formField' function to shrink the Elm form generation
code a bit.
Diffstat (limited to 'lib/VNWeb/Elm.pm')
-rw-r--r-- | lib/VNWeb/Elm.pm | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/VNWeb/Elm.pm b/lib/VNWeb/Elm.pm index a65844f8..78fad8c8 100644 --- a/lib/VNWeb/Elm.pm +++ b/lib/VNWeb/Elm.pm @@ -44,6 +44,7 @@ my %apis = ( Taken => [], # Username already taken DoubleEmail => [], # Account with same email already exists DoubleIP => [], # Account with same IP already exists + BadCurPass => [], # Current password is incorrect when changing password ); @@ -106,8 +107,8 @@ sub def_validation { $v{required} ? 'A.required True' : (), $v{minlength} ? "A.minlength $v{minlength}" : (), $v{maxlength} ? "A.maxlength $v{maxlength}" : (), - $v{min} ? "A.min $v{min}" : (), - $v{max} ? "A.max $v{max}" : (), + $v{min} ? 'A.min '.string($v{min}) : (), + $v{max} ? 'A.max '.string($v{max}) : (), $v{pattern} ? 'A.pattern '.string($v{pattern}) : () ).']' if !$obj->{keys}; $data; @@ -228,6 +229,10 @@ sub write_types { $data .= def urlStatic => String => string config->{url_static}; $data .= def adminEMail => String => string config->{admin_email}; + $data .= def userPerms => 'List (Int, String)' => list map tuple(VNWeb::Auth::listPerms->{$_}, string $_), sort keys VNWeb::Auth::listPerms->%*; + $data .= def skins => 'List (String, String)' => + list map tuple(string $_, string tuwf->{skins}{$_}[0]), + sort { tuwf->{skins}{$a}[0] cmp tuwf->{skins}{$b}[0] } keys tuwf->{skins}->%*; write_module Types => $data; } |