Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

sign in box built into page

2»

Answers

  • peregrineperegrine MVP
    edited May 2012

    the viewpaths seem to be picking up 3 directories. from the fetchview in signin.php for

    line 16: include $this->FetchViewLocation('passwordform');

    did you try creating this directory

    It's looking for themes/Fantasy Surf Team/views/plugin/

    and putting /applications/dashboard/views/entry/passwordform.php into

    themes/Fantasy Surf Team/views/plugin/passwordform.php

    it seems to assume plugin folder if not an application

    Frankly this all mystifies me, so I am just guessing

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • edited May 2012

    hmm am getting this error now

    Fatal error: Call to a member function Open() on a non-object in /home/mmatippi/domains/mma-tipping.com/public_html/fs/themes/Fantasy Surf Team/views/plugin/passwordform.php on line 6

    guessing I need to change the Url on line 6? Ive tried a few different things but dont fully understand it so im basically guessing

    <?php if (!defined('APPLICATION')) exit(); ?>
    <div>
       <?php
       // Make sure to force this form to post to the correct place in case the view is
       // rendered within another view (ie. /dashboard/entry/index/):
       echo $this->Form->Open(array('Action' => $this->Data('FormUrl', Url('/entry/signin')), 'id' => 'Form_User_SignIn'));
       echo $this->Form->Errors();
       ?>
       <ul>
          <li>
             <?php
                echo $this->Form->Label('Email/Username', 'Email');
                echo $this->Form->TextBox('Email');
             ?>
          </li>
          <li>
    
  • edited May 2012

    Am interrested in this.

    FYI I did the...
    include($this->FetchViewLocation('SignIn', 'entry', 'dashboard'));

    ...in default.master.php

    Worked fine if the page was at the sigin URL, .../entry/register

    However at the home page URL it bonked.

  • x00x00 MVP
    edited May 2012

    You are going to have to construct these forms yourself as modules, you can't really take something out of context and expect it work as if it was in context. it is not just a case of copying files across.

    Be happy with a simple logon form using standard markup if you are a php novice. Of course it won't have the connects, but if you aren't using them I wouldn't worry.

    You could also fetch the asset with jquery an insert it in a div, which is very similar to the current popup except it could be automatic. Like so:

    Add to your theme's /js/custom.js

    jQuery(document).ready(function($){
          $('#SignInForm').load('/entry/signin?DeliveryType=VIEW&DeliveryMethod=XHTML&Target='+encodeURIComponent(location.pathname));
    });
    

    and create a div somewhere on your page with the id SignInForm

    It is not really efficient though. I would do it so you click on somethign and it appears, but in you case it will appears in place rather than floating popup.

    That is all the help I have time to give.

    grep is your friend.

  • edited May 2012

    I have also tried coding it into the default.naster.php page like so....

    <?php if (!$Session->IsValid()) { ?>
    <form id="Form_User_SignIn" method="post" action="/community/forum/entry/signin">
    <input type="hidden" id="Form_hpt1" name="User/hpt" value="" style="display: none;" />
    <input type="hidden" id="Form_ClientHour1" name="User/ClientHour" value="<?php echo date('Y-m-d H:i'); ?>" />
    <input type="hidden" id="Form_TransientKey1" name="User/TransientKey" value="<?php echo Gdn::Session()->TransientKey(); ?>" />
    <input type="hidden" id="Form_Target1" name="User/Target" value="/" /> <ul>
    <label for="Form_Email">Email/Username</label>
    <input type="text" id="Form_Email1" name="User/Email" value="" class="InputBox" />
    <label for="Form_Password">Password</label>
    <input type="password" id="Form_Password1" name="User/Password" value="" class="InputBox Password" />
    <input type="submit" id="Form_SignIn" name="User/Sign_In" value="Sign In" class="Button" />
    <label for="SignInRememberMe" class="CheckBoxLabel">
    <input type="checkbox" id="SignInRememberMe" name="User/RememberMe" value="1" />
    <input type="hidden" name="Checkboxes[]" value="RememberMe" /> Keep me signed in</label>
    <a href="/community/forum/entry/passwordrequest" class="ForgotPassword">Forgot?</a>
    </form>
    <?php } ?>

    `

    However It doesn't work.
    Am assuming there is a transientkey value problem.

    On the upside I can get it exactly where I want it on the page, so not a total fail :-).

  • x00x00 MVP
    edited May 2012 Answer ✓

    Basically adapting the existing form.

    <div>
       <?php
       $Form = Gdn::Factory('Form');
       echo $Form->Open(array('Action' => $this->Data('FormUrl', Url('/entry/signin')), 'id' => 'Form_User_SignIn'));
       //echo $Form->Errors();
       ?>
       <ul>
          <li>
             <?php
                echo $Form->Label('Email/Username', 'Email');
                echo $Form->TextBox('Email');
             ?>
          </li>
          <li>
             <?php
                echo $Form->Label('Password', 'Password');
                echo $Form->Input('Password', 'password', array('class' => 'InputBox Password'));
                echo Anchor(T('Forgot?'), '/entry/passwordrequest', 'ForgotPassword');
             ?>
          </li>
          <li class="Buttons">
             <?php
                echo $Form->Button('Sign In');
                echo $Form->CheckBox('RememberMe', T('Keep me signed in'), array('value' => '1', 'id' => 'SignInRememberMe'));
             ?>
          </li>
       </ul>
       <?php
       echo $Form->Close();
       ?>
    </div>
    

    grep is your friend.

  • Thank you for the above.

    Have implemented it and it pretty well all works a treat.

    Just one strange thing going on with the "forgot?" link.
    When I hover the mouse over the link it shows the target URL (.../forum/entry/passwordrequest) in the browser status, however when it is clicked it stays on the same page and the username/password boxes disappear.

    No obvious errors are reported by the browser (firefox 8.0.1)

  • x00x00 MVP
    edited May 2012

    try change the line to

    echo Anchor(T('Forgot?'), '/entry/passwordrequest');

    that should hopefully stop any js shenanigans.

    grep is your friend.

  • Thanks all especially x00 that works great thanks.

  • x00 said:
    try change the line to

    echo Anchor(T('Forgot?'), '/entry/passwordrequest');

    that should hopefully stop any js shenanigans.

    Smooth!
    Nice one.

Sign In or Register to comment.