Drupal中自定义登录页面
通过覆写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中自定义登录页面的更多相关文章
- 为SharePoint 2010中的FBA创建自定义登录页面
SharePoint 2010中默认的FBA登录页面非常简单,只提供了一个Asp.Net的Login控件,让用户输入用户名和密码.在大多数情况下,我们需要定制这个页面以满足一些安全需求,比如为登录页面 ...
- spring security动态管理资源结合自定义登录页面
如果想将动态管理资源与自定义登录页面一起使用,最简单的办法就是在数据库中将登录页面对应的权限设置为IS_AUTHENTICATED_ANONYMOUSLY. 因此在数据库中添加一条资源信息. INSE ...
- CAS 4.0.x 自定义登录页面
版权声明:本文为博主原创文章,未经博主允许不得转载. 目录(?)[-] CAS默认登录页面 复制一个新的页面管理页面 修改页面引用 修改casproperties 修改casLoginViewjs ...
- (二)spring Security 自定义登录页面与校验用户
文章目录 配置 security 配置下 MVC 自定义登录页面 自定义一个登陆成功欢迎页面 效果图 小结: 使用 Spring Boot 的快速创建项目功能,勾选上本篇博客需要的功能:web,sec ...
- Spring MVC 项目搭建 -4- spring security-添加自定义登录页面
Spring MVC 项目搭建 -4- spring security-添加自定义登录页面 修改配置文件 <!--spring-sample-security.xml--> <!-- ...
- Spring security 知识笔记【自定义登录页面】
一.引入依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId> ...
- Spring Security 自定义登录页面
SpringMVC + Spring Security,自定义登录页面登录验证 学习参考:http://www.mkyong.com/spring-security/spring-security-f ...
- MVC4.0 使用Form认证,自定义登录页面路径Account/Login
使用MVC4.0的时候,一般遇到会员登录.注册功能,我们都会使用Form认证,给需要身份验证的Action进行授权(需要登录后才能访问的Action添加[Authorize]属性标签),登录.注册的时 ...
- Springsecurity搭建自定义登录页面
1.springSecurity的搭建 新建一个springboot的web项目,我这边只选中了web,建立后如下: pom依赖: <!-- https://mvnrepository.com/ ...
随机推荐
- 在WAS控制台,环境下添加新的虚拟主机别名
错误现象: 11/16/13 16:52:22:612 CST] 00000021 util W com.ibm.ws.webcontainer.util.VirtualHostCo ...
- xalan\xalan\2.7.2\xercesImpl.jar (系统找不到指定的文件)问题
本文转自:http://blog.csdn.net/lveliu/article/details/77772828 环境搭建为:maven+tomcat tomcat 8.5.2 以上会出现改问题(包 ...
- crm动态载入js库
function load_script(url) { var xmlHTTPRequest; if (window.ActiveXObject) { xmlHTTPR ...
- C/C++心得-结构体
先说句题外话,个人认为,基本上所有的高级语言被设计出来的最终目的是降低软件开发难度,提升软件开发人员素质和团队协作能力,降低软件维护的难度.在学习语言的时候,可以从这么方面来推测各种语言语法设计的原因 ...
- EasyUI使用之鼠标双击事件
easyui鼠标双击事件,使用 onDblClickRow(index, row) 事件,在用户双击一行的时候触发,参数包括: index:点击的行的索引值,该索引值从0开始. row:对应于点击行的 ...
- 用python实现ping
#!/usr/bin/env python #coding=utf-8 import os import argparse import socket import struct import sel ...
- PAT——1011. A+B和C
给定区间[-231, 231]内的3个整数A.B和C,请判断A+B是否大于C. 输入格式: 输入第1行给出正整数T(<=10),是测试用例的个数.随后给出T组测试用例,每组占一行,顺序给出A.B ...
- Mac--查看公钥
打开macbook的终端输入以下命令: $ cd ~/.ssh $ ls $ cat id_rsa.pub
- HDU 2018母牛的故事(类似斐波那契,找规律)
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=2018 母牛的故事 Time Limit: 2000/1000 MS (Java/Others) ...
- 《Linux 学习》01---redis安装, 并使用Redis Desktop Manager 连接
一.环境简介: linux 系统:centos 7.X 二.安装大纲: 1.下载安装包 2.安装 3.统一管理redis 配置文件 4.编辑redis配置文件,设置常用的功能 5.(1)命令启动,连接 ...