from django.shortcuts import render_to_response
  
  from social_auth import __version__ as version
- from social_auth.backends import BACKENDS, OpenIdAuth, BaseOAuth, BaseOAuth2
  
 -
  def home(request):
      """Home view, displays login mechanism"""
      if request.user.is_authenticated():
 
            <input type="submit" value="Login"/>
          </div>
        </form>
-     </li>
-     <li>
+       {% else %}
+         {% if name == "openid" %}
 +      <form action="{% url socialauth_associate_begin "yandex" %}" method="post">{% csrf_token %}
 +        <div>
 +          <label for="openid_ya_user">Yandex user
 +            {% if yandex %}(<span class="disconnect"><a href="{% url disconnect "yandex" %}">disconnect</a>)</span>{% endif %}
 +          </label>
 +          <input id="openid_ya_user" type="text" value="" name="openid_ya_user" />
 +          <input type="submit" value="Login"/>
 +        </div>
 +      </form>
 +    </li>
 +    <li>
-       <form action="{% url socialauth_associate_begin "openid" %}" method="post">{% csrf_token %}
-         <div>
-           <label for="openid_identifier">Other provider:</label>
-           <input id="openid_identifier" type="text" value="" name="openid_identifier" />
-           <input type="submit" />
-         </div>
-       </form>
+         <form action="{% url socialauth_associate_begin "openid" %}" method="post">{% csrf_token %}
+           <div>
+             <label for="openid_identifier">Other provider</label>
+             <input id="openid_identifier" type="text" value="" name="openid_identifier" />
+             <input type="submit" value="Login" />
+           </div>
+           <p class="helptext">Like your personal <a href="https://www.myopenid.com/" title="My OpenId">myopenid</a></p>
+         </form>
+         {% endif %}
+       {% endif %}
+     {% endif %}
      </li>
+   {% endfor %}
    </ul>
  </div>
  
 
            <input type="submit" value="Login"/>
          </div>
        </form>
+       {% else %}
+         {% if name == "openid" %}
+         <form action="{% url socialauth_begin "openid" %}" method="post">{% csrf_token %}
+           <div>
+             <label for="openid_identifier">Other provider</label>
+             <input id="openid_identifier" type="text" value="" name="openid_identifier" />
+             <input type="submit" value="Login" />
+           </div>
+           <p class="helptext">Like your personal <a href="https://www.myopenid.com/" title="My OpenId">myopenid</a></p>
+         </form>
+         {% endif %}
+       {% endif %}
+     {% endif %}
      </li>
-     <li>
-       <form action="{% url socialauth_begin "yandex" %}" method="post">{% csrf_token %}
-         <div>
-           <label for="openid_ya_user">Yandex user(optional):</label>
-           <input id="openid_ya_user" type="text" value="" name="openid_ya_user" />
-           <input type="submit" value="Login"/>
-         </div>
-       </form>
-     </li>
-       <li><a rel="nofollow" href="{% url socialauth_begin "socialauth_begin" %}">Yandex OpenID 2.0</a></li>
-     <li>
-     <form action="{% url socialauth_begin "openid" %}" method="post">{% csrf_token %}
-         <div>
-           <label for="openid_identifier">Other provider</label>
-           <input id="openid_identifier" type="text" value="" name="openid_identifier" />
-           <input type="submit" value="Login" />
-         </div>
-         <p class="helptext">Like your personal <a href="https://www.myopenid.com/" title="My OpenId">myopenid</a></p>
-       </form>
-     </li>
+   {% endfor %}
    </ul>
  </div>
 +
 +<div>
 +  <h3>Login using other authentication systems:</h3>
 +      <ul>
 +              <li><a rel="nofollow" href="{% url socialauth_begin "vkontakte" %}">VKontakte OpenAPI</a></li>
 +      </ul>
 +</div>
  {% endblock %}