1 (edited by Developer 2009-05-06 21:15)

Topic: Help with Login

Hello

I maded a form for login on my index.html page

<form id="login" name="login" method="post" action="login.php?action=in" onsubmit="return process_form(this)">
            
                    <input type="hidden" name="form_sent" value="1" />
                    <input type="hidden" name="redirect_url" value="<?php echo $redirect_url ?>" />
                    Username
                    
                    <input type="text" name="req_username" size="16" maxlength="25" />
                    &nbsp; Password
 
                    <input type="password" name="req_password" size="16" maxlength="16" />
                    &nbsp;<a href="#" onclick="document.login.submit(); return false"> Login</form>';

but when i enter the username and password it redirect me to login page and then
say me to confirm the username and pass
how can i made that he not ask me that?

Re: Help with Login

Please, post here the code of JS-function "process_form". Maybe there is an error in this function.

3 (edited by Developer 2009-05-07 07:19)

Re: Help with Login

??
there is no function process_form ....
and the error is with Confirm action :
Unable to confirm security token. A likely cause for this is that some time passed between when you first entered the page and when you submitted a form or clicked a link. If that is the case and you would like to continue with your action, please click the Confirm button. Otherwise, you should click the Cancel button to return to where you were.
but if i disable it when i try to login it just redirect me to login page and fill up the form...
i tryed with this mod to http://punbb.informer.com/forums/topic/ … frontpage/
but it not work

Re: Help with Login

Ok, I have modified your code:

<form id="login" name="login" method="post" action="login.php" onsubmit="return process_form(this)">
    <input type="hidden" name="form_sent" value="1" />
    <input type="hidden" name="csrf_token" value="<?php echo generate_form_token(forum_link($forum_url['login'])) ?>" />
    <input type="hidden" name="redirect_url" value="<?php echo $redirect_url ?>" />
    Username
                    
    <input type="text" name="req_username" size="16" maxlength="25" />
    &nbsp; Password
 
     <input type="password" name="req_password" size="16" maxlength="16" />
     &nbsp;<a href="#" onclick="document.login.submit(); return false"> Login</form>';

Re: Help with Login

Slavok wrote:

Ok, I have modified your code:

<form id="login" name="login" method="post" action="login.php" onsubmit="return process_form(this)">
    <input type="hidden" name="form_sent" value="1" />
    <input type="hidden" name="csrf_token" value="<?php echo generate_form_token(forum_link($forum_url['login'])) ?>" />
    <input type="hidden" name="redirect_url" value="<?php echo $redirect_url ?>" />
    Username
                    
    <input type="text" name="req_username" size="16" maxlength="25" />
    &nbsp; Password
 
     <input type="password" name="req_password" size="16" maxlength="16" />
     &nbsp;<a href="#" onclick="document.login.submit(); return false"> Login</form>';

same problem again

6 (edited by Nigg 2009-05-14 08:59)

Re: Help with Login

I also have the same problem. Login does not work, the Pun shows the confirm-page. Logout does work!

/**
     *  @brief  returns the login formular
     *  @return [string] form HTML
     */
    public static function getFormLogin()
    {
        global $dict;
       
        $register_url = forum_link('register.php');
        $redirect_url = $_SERVER['REQUEST_URI'];
        $post_url     = forum_link('login.php');
        $csrf_token   = generate_form_token($post_url);

        $form = '
            <form id="login" name="login" method="post" action="'.$post_url.'" accept-charset="utf-8">
                <input type="hidden" name="form_sent" value="1" />
                <input type="hidden" name="redirect_url" value="'.$redirect_url.'" />
                <input type="hidden" name="csrf_token"   value="'.$csrf_token.'" />
                <label for="req_username">'.$dict->getDict( 'username', 'login').': </label><input type="text" name="req_username" size="16" maxlength="25" />
                <label for="req_password">'.$dict->getDict( 'password', 'login').': </label><input type="password" name="req_password" size="16" maxlength="16" />
                <input type="submit" name="submit" value="'.$dict->getDict( 'login', 'login').'">
        <a href="#" onclick="document.login.submit(); return false;">'.$dict->getDict( 'login', 'login').'</a>
        &nbsp; | &nbsp;
        <a href="'.$register_url.'">'.$dict->getDict( 'register', 'login').'</a>
            </form>';
   
        return $form;
    }

/**
     *  @brief  returns the logout formular
     *  @return [string] form HTML
     */
    public static function getFormLogout()
    {
        global $dict, $currentuser;

        $redirect_url = $_SERVER['REQUEST_URI'];
        $post_url     = forum_link('login.php').'?action=out&amp;id='.$currentuser->getID();
        $csrf_token   = generate_form_token($post_url);
   
        $form = '
            <form id="login" name="login" method="post" action="'.$post_url.'">
                <input type="hidden" name="form_sent" value="1" />
                <input type="hidden" name="redirect_url" value="'.$redirect_url.'" />
                <input type="hidden" name="csrf_token"   value="'.$csrf_token.'" />
                <input type="submit" name="submit" value="'.$dict->getDict( 'logout', 'login').'">
            </form>';
   
        return $form;
    }