예제 #1
0
    function show_form($data = null)
    {
        if (empty($data['phone_method'])) {
            $data['phone_method'] = 'sms';
        }
        $form = new Form();
        $form->start($data);
        $form->errors($this->err_flds);
        if (!$this->is_logged_in()) {
            $form->text('userid', 'Desired User ID:', 15, 'UserID');
            $form->text('pw1', 'Password:'******'Password', true, true);
            $form->password_strength('pw1', '');
            $form->text('pw2', 'Repeat:', 50, 'Password', true, true);
        }
        $form->text('first', 'First Name:', 25, 'First Name');
        $form->hspace(3);
        $form->text('last', 'Last Name:', 25, 'Last Name', false);
        $form->text('email', 'Email:', 75, '*****@*****.**');
        $form->text('phone', 'Verification Phone:', 25, '303-555-1234');
        $form->radio('phone_method', 'SMS (text)', 'sms');
        $form->hspace(5);
        $form->radio('phone_method', 'Voice', 'voice', false);
        $form->button('action_register', $this->is_logged_in() ? 'Save' : 'Register');
        // Next line for clickjacking example
        //$form->button('action_disable', 'Disable 2FA');
        $form->end();
        $userid = isset($data['userid']) ? $data['userid'] : '';
        echo <<<EOT
    <script>
    \$('#pw1').bind('keydown', function() {
        PasswordDidChange('pw1', '{$userid}');
    });
    </script>
EOT;
    }
예제 #2
0
 protected function show_form($row)
 {
     $f = new Form();
     $f->start($row);
     $f->hidden('member_id', $row['member_id']);
     $f->text('last', 'Last Name:', 30, 'Last Name');
     $f->text('first', 'First:', 20, 'First Name', false);
     $f->text('street', 'Street:', 50, 'Street');
     $f->text('city', 'City:', 20, 'City');
     $f->text('state', 'State:', 10, 'State', false);
     $f->foreign_key('specialty_id', 'name', 'Specialty');
     $f->radio('billing', 'Monthly', 'month');
     $f->hspace(2);
     $f->radio('billing', 'Yearly', 'year', false);
     $f->hspace(2);
     $f->radio('billing', 'Recurring', 'recurring', false);
     $f->menu('contact', 'Contact:', array('phone', 'email', 'mail', 'none'), true, 'email');
     $f->checkbox('premium', 'Premium:', false);
     $f->date('since', 'Member Since:', false);
     if ($this->ac->has_permission('member-edit')) {
         $f->button('action_save', 'Save');
     }
     $f->end();
 }
예제 #3
0
 function show_form($data = null)
 {
     $new = is_null($data);
     if (empty($data['phone_method'])) {
         $data['phone_method'] = 'sms';
     }
     $f = new Form();
     $f->start($data);
     $f->errors($this->err_flds);
     $f->hidden('new', $new ? '1' : '0');
     if ($new) {
         $readonly = false;
         $userid = '';
     } else {
         $readonly = true;
         $userid = $data['userid'];
     }
     $f->text('userid', 'User ID:', 25, 'User ID', true, false, $readonly);
     $f->text('first', 'First Name:', 25, 'First Name');
     $f->hspace(3);
     $f->text('last', 'Last Name:', 25, 'Last Name', false);
     $f->text('email', 'Email:', 75, '*****@*****.**');
     $f->text('phone', 'Verification Phone:', 25, '303-555-1234');
     $f->radio('phone_method', 'SMS (text)', 'sms');
     $f->hspace(5);
     $f->radio('phone_method', 'Voice', 'voice', false);
     echo '<p class=label>Roles:';
     if ($new && false) {
         $stmt = $this->db->query('select * from role order by role');
     } else {
         $stmt = $this->db->query('select * from role
       left join (select * from user_role where userid = :userid) as ur using (role)
       order by role', array('userid' => $userid));
     }
     for ($n = 1; $row = $stmt->fetch(); $n++) {
         echo '<br>';
         $fld = "fld_{$n}";
         $checked = isset($row['userid']) ? 'checked' : '';
         echo "<input id={$fld} type=checkbox name=role[]\n          value={$row['role']} {$checked}>";
         $f->label($fld, $row['role'], false);
     }
     $f->button('action_save', 'Save');
     $f->end();
     $this->ac->show_permissions($userid);
 }