How can I create my own login box in a topic of my choice?

<verbatim class="foswikiHidden">
  %STARTSECTION{"login"}%<div id="foswikiLogin">
    <div class="foswikiFormSteps">
      <form action='%SCRIPTURLPATH{"login"}%' name='loginform' method='post' id="loginform">
        <input type="hidden" name="foswiki_origin" value="%SCRIPTURL{"view"}%/%BASEWEB%/%BASETOPIC%"/>
        <div class='foswikiFormStep'>
          <h2>Log on with your username and password</h2>
          <div style="display:block;"></div>
        </div>
        <div class="foswikiFormStep">
          <h3><a name="Username" id="Username"></a> %MAKETEXT{"Username"}%</h3>

          <input tabindex='1' type='text' class='foswikiInputField foswikiFocus' size='40' name='username' value='' />
        </div>
        <div class="foswikiFormStep">
          <h3><a name="Password" id="Password"></a> %MAKETEXT{"Password"}%</h3>

          <input tabindex='2' type='password' class='foswikiInputField' size='40' name='password' value='' />
          [[System/ResetPassword][%MAKETEXT{"I forgot my password"}%]]
        </div>
        <div class="foswikiFormStep">

          <input tabindex='4' type='submit' class='foswikiSubmit' value='%MAKETEXT{"Logon"}%' />
        </div>
      </form>

      <div class="foswikiFormStep">
        <p class="foswikiGrayText">If you have any questions, please contact
        %WIKIWEBMASTER% </p>
      </div>
    </div>
  </div>%ENDSECTION{"login"}%</verbatim>

%STARTSECTION{"code"}%%IF{
  "context authenticated"
  then="%MAKETEXT{"Welcome"}%, [[%WIKIUSERNAME%][%WIKINAME%]] $percntLOGOUT$percnt"
  else="$percntINCLUDE{\"%TOPIC%\" section=\"login\"}$percnt"
}%%ENDSECTION{"code"}%

Test:

Log on with your username and password

Username

If you have any questions, please contact webmaster@foswiki.org

TODO

  • Why is it so hard to use the login.tmpl defs? I ended up re-producing PatternSkin's HTML for /bin/login in this FAQ.
  • Make this redirect back to Faq64 after login
  • Show an example using an iframe instead

Support.FAQForm edit

TopicClassification FrequentlyAskedQuestion
Subject Registration or Authentication or Authorisation
Topic Summary
Extension
Interested Parties
Related Topics CommandAndCGIScripts
Topic revision: r2 - 27 Dec 2011, ArthurClemens - This page was cached on 25 Nov 2017 - 02:47.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License