$(document).ready(function(){"; if(is_logged_in() && is_verified()){ echo "runWhenExists('ServerPing');"; } if(has_flag($user,'u')){ echo "runWhenExists('FetchMemos');"; echo "runWhenExists('FetchNews');"; echo "runWhenExists('FetchChannels');"; } echo "});"; if(has_flag($user,'u')){ ?>
'memo-diag', 'type'=>'form', 'form_id'=>'memo', 'form_submit_label'=>'Send', 'form_fields'=>array( array( 'name'=>'to', 'label'=>__('To'), 'type'=>'string', 'value'=>'' ), array( 'name'=>'message', 'label'=>__('Message'), 'type'=>'string', 'value'=>'' ), array( 'name'=>'action', 'type'=>'hidden', 'value'=>'send-memo' ) ) )); array_push($dialogs,array( 'id'=>'channel-diag', 'type'=>'form', 'form_id'=>'channel', 'form_submit_label'=>'Register', 'form_fields'=>array( array( 'name'=>'channel', 'label'=>__('Channel Name'), 'type'=>'string', 'value'=>'' ), array( 'name'=>'action', 'type'=>'hidden', 'value'=>'register-channel' ) ) )); } ?>
Enable 2-factor Authentication'.get_form_html('2-factor',array( array( 'name'=>'country-code', 'label'=>__('Country'), 'type'=>'text', 'attributes'=>array( 'id'=>'authy-countries' ) ), array( 'name'=>'cellphone', 'label'=>__('Cell #'), 'type'=>'text', 'attributes'=>array( 'id'=>'authy-cellphone' ) ), array( 'name'=>'action', 'type'=>'hidden', 'value'=>'2-factor-register' ) ),'Submit').'
'; break; case 'google-authenticator': $api = get_api(); $_SESSION['secret_key'] = $api->createSecret(); echo '
Enable 2-factor Authentication'.get_form_html('2-factor',array( array( 'type'=>'custom', 'html'=>"" ), array( 'name'=>'token', 'label'=>__('Token'), 'type'=>'text' ), array( 'name'=>'action', 'type'=>'hidden', 'value'=>'2-factor-register' ) ),'Submit').'
'; break; default: } }else{ switch(get_conf('2-factor-method')){ case 'authy':case 'google-authenticator': echo ""; break; default: } } if(get_conf('persona-endpoint') != 'none'){ echo "
".__('Link Persona')."
"; $emails = get_emails($user['id'],true); foreach($emails as $k => $email){ echo "
{$email['email']}
"; } } } ?>
'newpass-diag', 'type'=>'form', 'form_id'=>'newpass', 'form_submit_label'=>__('Change Password'), 'form_fields'=>array( array( 'name'=>'password', 'label'=>__('Password'), 'type'=>'password', 'value'=>'' ), array( 'name'=>'newpass', 'label'=>__('New Password'), 'type'=>'password', 'value'=>'' ), array( 'name'=>'action', 'type'=>'hidden', 'value'=>'newpass' ) ) )); $roles = array(array( 'value'=>'user', 'label'=>__('User') )); if($res = query("SELECT rt.name AS value,rt.description AS label FROM user_role_types rt JOIN user_roles r ON r.user_role_id = rt.id JOIN users u ON r.user_id = u.id WHERE u.id = %d",array($user['id']))){ while($role = $res->fetch_assoc()){ array_push($roles,$role); } } array_push($dialogs,array( 'id'=>'roles-diag', 'type'=>'form', 'form_id'=>'roles', 'form_submit_label'=>__('Switch'), 'form_fields'=>array( array( 'name'=>'type', 'label'=>__('Type'), 'type'=>'select', 'values'=>$roles, 'value'=>isset($_COOKIE['type'])?$_COOKIE['type']:'user' ), array( 'name'=>'action', 'type'=>'hidden', 'value'=>'role' ) ) )); }elseif($user && !$flag){ array_push($dialogs,array( 'id'=>'verify-diag', 'type'=>'form', 'autocomplete'=>'off', 'form_id'=>'verify', 'form_submit_label'=>__('Login'), 'form_fields'=>array( array( 'name'=>'token', 'label'=>__('2-Factor Verification'), 'type'=>'text', 'attributes'=>array( 'id'=>'authy-token', 'style'=>'background-color:#F2DEDE;' ) ), array( 'name'=>'action', 'type'=>'hidden', 'value'=>'verify' ) ) )); }else{ $roles = array(array( 'value'=>'user', 'label'=>__('User') )); if($res = query("SELECT name AS value,description AS label FROM ircd.user_role_types")){ while($role = $res->fetch_assoc()){ array_push($roles,$role); } } array_push($dialogs,array( 'id'=>'login-diag', 'type'=>'form', 'form_id'=>'login', 'form_submit_label'=>__('Login'), 'form_fields'=>array( array( 'type'=>'custom', 'html'=>get_conf('persona-endpoint') != 'none'?"
".__('Persona')."
":'' ), array( 'name'=>'username', 'label'=>__('Username'), 'type'=>'text', 'value'=>'' ), array( 'name'=>'password', 'label'=>__('Password'), 'type'=>'password', 'value'=>'' ), array( 'name'=>'type', 'label'=>__('Type'), 'type'=>'select', 'values'=>$roles ), array( 'name'=>'action', 'type'=>'hidden', 'value'=>'login' ) ) )); } ?>
$diag){ echo "
"; switch($diag['type']){ case 'form': array_push($diag['form_fields'],array( 'type'=>'submit', 'value'=>$diag['form_submit_label'] )); $attributes = array( 'id'=>$diag['form_id'] ); if(isset($diag['autocomplete'])){ $attributes['autocomplete'] = $diag['autocomplete']; } echo get_form_html_advanced($attributes,$diag['form_fields']); break; } echo "
"; } ?>