通过覆写template定义新的user_login表单来为自定义登录页面。
方法:

1.  本站使用的主题是Rorty。来到\sites\all\themes\rorty,打开template.php,添加代码。目的是为登录页面指定一个新的模版,路径是templates/user/user_login,渲染类      型是form表单

function rorty_theme(&$existing, $type, $theme, $path) {
$hooks['user_login'] = array(
'template' => 'templates/user/user_login',
'render element' => 'form',
);
// $hooks['user_register_form'] = array(
// 'template' => 'templates/user/user_register',
// 'render element' => 'form',
// );
return $hooks;
}

2.  根据'template'参数路径,在templates目录下建立user\user_login.tpl.php文件。
3.  仿照之前的登录页面。重写代码。比如再写form标签了。

<div class="form-item form-type-textfield form-item-name">
<label for="edit-name">Username <span class="form-required" title="This field is required.">*</span></label>
<input type="text" id="edit-name" name="name" value="" size="60" maxlength="60" class="form-text required">
<div class="description">Enter your Rorty username.</div>
</div> <div class="form-item form-type-password form-item-pass">
<label for="edit-pass">Password <span class="form-required" title="This field is required.">*</span></label>
<input type="password" id="edit-pass" name="pass" size="60" maxlength="128" class="form-text required">
<div class="description">Enter the password that accompanies your username.</div>
</div> <?php print drupal_render($form['form_id']); ?>
<?php print drupal_render($form['locale']); ?>
<?php print drupal_render($form['honeypot_time']); ?> <div class="form-actions form-wrapper" id="edit-actions">
<input type="submit" id="edit-submit" name="op" value="Log in" class="form-submit" />
<input type="button" name="op2" value="Register" class="form-submit" onclick="location.href='user/register'"/>
</div>

4.  清空缓存。重新来到登录页面www.xxx.com/user/login,查看效果。

Drupal中自定义登录页面的更多相关文章

  1. 为SharePoint 2010中的FBA创建自定义登录页面

    SharePoint 2010中默认的FBA登录页面非常简单,只提供了一个Asp.Net的Login控件,让用户输入用户名和密码.在大多数情况下,我们需要定制这个页面以满足一些安全需求,比如为登录页面 ...

  2. spring security动态管理资源结合自定义登录页面

    如果想将动态管理资源与自定义登录页面一起使用,最简单的办法就是在数据库中将登录页面对应的权限设置为IS_AUTHENTICATED_ANONYMOUSLY. 因此在数据库中添加一条资源信息. INSE ...

  3. CAS 4.0.x 自定义登录页面

    版权声明:本文为博主原创文章,未经博主允许不得转载.   目录(?)[-] CAS默认登录页面 复制一个新的页面管理页面 修改页面引用 修改casproperties 修改casLoginViewjs ...

  4. (二)spring Security 自定义登录页面与校验用户

    文章目录 配置 security 配置下 MVC 自定义登录页面 自定义一个登陆成功欢迎页面 效果图 小结: 使用 Spring Boot 的快速创建项目功能,勾选上本篇博客需要的功能:web,sec ...

  5. Spring MVC 项目搭建 -4- spring security-添加自定义登录页面

    Spring MVC 项目搭建 -4- spring security-添加自定义登录页面 修改配置文件 <!--spring-sample-security.xml--> <!-- ...

  6. Spring security 知识笔记【自定义登录页面】

    一.引入依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId> ...

  7. Spring Security 自定义登录页面

    SpringMVC + Spring Security,自定义登录页面登录验证 学习参考:http://www.mkyong.com/spring-security/spring-security-f ...

  8. MVC4.0 使用Form认证,自定义登录页面路径Account/Login

    使用MVC4.0的时候,一般遇到会员登录.注册功能,我们都会使用Form认证,给需要身份验证的Action进行授权(需要登录后才能访问的Action添加[Authorize]属性标签),登录.注册的时 ...

  9. Springsecurity搭建自定义登录页面

    1.springSecurity的搭建 新建一个springboot的web项目,我这边只选中了web,建立后如下: pom依赖: <!-- https://mvnrepository.com/ ...

随机推荐

  1. 跟着大神学Mongo,Mongodb主从复制本机简单操作总结

    原文链接:http://www.cnblogs.com/huangxincheng/archive/2012/03/04/2379755.html 本机安装MongoDB不在介绍,本文Mongo小菜鸟 ...

  2. 【转】Linux如何查看JDK的安装路径

    http://www.cnblogs.com/kerrycode/archive/2015/08/27/4762921.html 如何在一台Linux服务器上查找JDK的安装路径呢? 有那些方法可以查 ...

  3. 二. Python WebDriver环境搭建

    1. 安装Selenium 在命令行中输入: 显示安装成功: 2. 测试例子 打开百度页面并在输入框输入搜索内容(默认为firework) # 1. Selenium默认为Firefox.验证 fro ...

  4. FactoryBean的实现原理与作用

    FactoryBean与BeanFactory: 这俩货在拼写上很是相似,很多同学在看IOC源码或者其他地方并不能分清有啥区别,前面的IOC源码中我简单说过,现在统一简单来讲一下: FactoryBe ...

  5. 【luogu P3623 [APIO2008]免费道路】 题解

    题目链接:https://www.luogu.org/problemnew/show/P3623 说是对克鲁斯卡尔的透彻性理解 正解: 先考虑加入水泥路,然后再考虑加入剩下必须要加入的最少鹅卵石路. ...

  6. 【Node.js】新建一个NodeJS 4.X项目

    前提工作 1.安装Node.js 各种下一步就好 2.安装NPM(node package manager) 安装好Node.js之后,打开cmd,输入npm install npm -g,程序会自动 ...

  7. JS异步编程 (2) - Promise、Generator、async/await

    JS异步编程 (2) - Promise.Generator.async/await 上篇文章我们讲了下JS异步编程的相关知识,比如什么是异步,为什么要使用异步编程以及在浏览器中JS如何实现异步的.最 ...

  8. DQL-子查询

    一:含义 嵌套在其他语句内部的select语句称之为子查询或内查询 外套的语句还可以是 insert,update,delete,一般用select比较多 外面如果是select语句,我们称之为外查询 ...

  9. Oracle树形结构数据-相关知识总结

    Oracle树形结构数据--基本知识 1.数据组成 2.基本查询 2.1.查询某节点及该节点下的所有子孙节点 SELECT   *      FROM QIANCODE.TREE_TABLE_BASI ...

  10. 在mac下运行 npm run eject 出现报错问题解决方法

    当使用create-react-app创建项目后,接着运行npm run eject时,如果出现下面的错误 可能是脚手架添加了.gitignore这个文件,但是没有本地仓库,可以使用以下代码解决这个问 ...