sharepoint 修改AD密码
sharepoint 修改AD密码
下面是添加添加“空元素”代码:
第一个<CustomAction>是添加修改密码项目
第二个<CustomAction>是添加js修改脚本
- <?xml version="1.0" encoding="utf-8"?>
- <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
- <CustomAction
- Id="{F93B1F84-1DBE-4C10-82E3-2CA47346359E}"
- Title="修改密码"
- Description="此处修改的是域里面的密码"
- Sequence=""
- Location="Microsoft.SharePoint.StandardMenu"
- GroupId="PersonalActions"
- ImageUrl="~sitecollection/_layouts/images/menulistsettings.gif">
- <UrlAction Url="javascript:portal_openModalDialog();"/>
- </CustomAction>
- <CustomAction Id="ScriptLink.jQuery"
- Title="ScriptLink.jQuery"
- Location="ScriptLink"
- ScriptBlock=" function portal_openModalDialog() {
- var options = SP.UI.$create_DialogOptions();
- options.width = ;
- options.height = ;
- options.url = '/_layouts/updatepassword.aspx';
- options.dialogReturnValueCallback = Function.createDelegate(null, portal_modalDialogClosedCallback);
- SP.UI.ModalDialog.showModalDialog(options);
- }
- //SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.OK, 1); //关闭函数
- function portal_modalDialogClosedCallback(result, value) {
- if (value == '') {
- SP.UI.Notify.addNotification('修改成功');
- }
- else if(value == ''){
- SP.UI.Notify.addNotification('修改失败,请重新修改');
- }
- }
- function closeDialog() {
- SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.cancel, );
- }
- "
- />
- </Elements>
以下是update.aspx
- using System;
- using Microsoft.SharePoint;
- using Microsoft.SharePoint.WebControls;
- using System.DirectoryServices.AccountManagement;
- namespace ChangePassword.Layouts
- {
- public partial class updatepassword : LayoutsPageBase
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- lblMassage.Text = "";
- }
- private string _userName;
- private string _domainName;
- private PrincipalContext _principalContext;
- private UserPrincipal _userPrincipal;
- protected void btnUpdate_Click(object sender, EventArgs e)
- {
- _userName = SPContext.Current.Web.CurrentUser.LoginName;
- if (_userName.IndexOf("\\") > )
- {
- try
- {
- if (_userName.Contains("|"))
- {
- _domainName = _userName.Split('\\')[].Split('|')[];
- }
- else
- {
- _domainName = _userName.Split('\\')[];
- }
- _userName = _userName.Split('\\')[];
- _principalContext = new PrincipalContext(ContextType.Domain, _domainName, _userName, txtOldPwd.Text);
- //这个方法也容易出问题,如果旧密码输入错误,这查找也会出错,
- _userPrincipal = UserPrincipal.FindByIdentity(_principalContext, _userName);
- if (_userPrincipal != null)
- {
- //这一点容易出错,是有关密码策略的问题
- //密码不满足密码策略的要求。检查最小密码长度、密码复杂性和密码历史的要求。 (异常来自 HRESULT:0x800708C5)
- _userPrincipal.ChangePassword(txtOldPwd.Text, txtNewPwd.Text);
- _userPrincipal.Save();
- Response.Write(
- "<script type=\"text/javascript\">window.frameElement.commonModalDialogClose(1, 1);</script>");
- }
- }
- catch (Exception ex)
- {
- lblMassage.Text = ex.Message;
- }
- }
- }
- }
- }
- <%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
- <%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>
- <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
- <%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
- <%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
- <%@ Import Namespace="Microsoft.SharePoint" %>
- <%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
- <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="updatepassword.aspx.cs" Inherits="ChangePassword.Layouts.updatepassword" DynamicMasterPageFile="~masterurl/default.master" %>
- <asp:Content ID="PageHead" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
- </asp:Content>
- <asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
- <table cellpadding="" cellspacing="" border="">
- <tr>
- <td>旧密码:</td>
- <td><asp:TextBox ID="txtOldPwd" runat="server"></asp:TextBox></td>
- </tr>
- <tr>
- <td>新密码:</td>
- <td><asp:TextBox ID="txtNewPwd" runat="server"></asp:TextBox></td>
- </tr>
- <tr>
- <td>确认密码:</td>
- <td><asp:TextBox ID="txtConfirmPwd" runat="server"></asp:TextBox></td>
- </tr>
- <tr>
- <td><asp:Button ID="btnUpdate" runat="server" Text="修改" OnClick="btnUpdate_Click" /></td>
- <td><asp:Button ID="btnCancel" runat="server" Text="取消" OnClientClick="closeDialog()" /></td>
- </tr>
- </table>
- <br />
- <asp:Label ID="lblMassage" runat="server" ForeColor="Red" Text=""></asp:Label>
- </asp:Content>
- <asp:Content ID="PageTitle" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server">
- 修改密码
- </asp:Content>
- <asp:Content ID="PageTitleInTitleArea" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea" runat="server" >
- 我的应用程序页
- </asp:Content>
sharepoint 修改AD密码的更多相关文章
- 在泛微系统中修改AD密码的配置
参照文档: Windows server 2008 R2 安装AD域证书:https://blog.csdn.net/zhuyongru/article/details/81107839 配置泛微OA ...
- Python 修改AD密码
前提条件: AD 已开启证书服务(最重要的一句话). import ldap3 SERVER = 'adserver' BASEDN = "DC=example,DC=com" U ...
- 烦烦烦SharePoint2013 以其他用户登录和修改AD域用户密码
sharepoint默认是没有修改AD密码 和切换 用户的功能,这里我用future的方式来实现. 部署wsp前: 部署后 点击以其他用户身份登录 点击修改用户密码: 这里的扩展才菜单我们用Custo ...
- SharePoint2013 以其他用户登录和修改AD域用户密码 功能
sharepoint默认是没有修改AD密码 和切换 用户的功能,这里我用future的方式来实现. 部署wsp前: 部署后: 点击以其他用户身份登录 点击修改用户密码: 这里的扩展才菜单我们用Cust ...
- SharePoint中修改密码的WEB Part之终极版:即可以修改AD,又可以修改本机用户密码的Web Part!!
转:http://www.cnblogs.com/dosboy/archive/2007/08/01/838859.html 在网上查了那么多SharePoint密码修改的第三方开发,都有问题.总结下 ...
- sharepoint修改密码
增加SharePoint2010修改域密码功能 前提SharePoint2010的用户基于AD的,因此修改密码是修改了AD的密码,当然也可以修改本机密码(非域的密码).这里我们讨论修改域密码.我们修改 ...
- java修改AD域用户密码使用SSL连接方式
正常情况下,JAVA修改AD域用户属性,只能修改一些普通属性, 如果要修改AD域用户密码和userAccountControl属性就得使用SSL连接的方式修改, SSL连接的方式需要操作以下步骤: 1 ...
- C#修改AD账号及密码
在使用AD域环境搭建的账号系统修改密码的时候比较麻烦一般需要管理员在域环境去进行对用户的密码进行修改. 以下就是用来查询和修改AD域密码的方法. 1 /// <summary> 2 /// ...
- 增加SharePoint2010修改域密码功能
转:http://blog.163.com/hr_test/blog/static/16485210720137953131694/ 前提 SharePoint2010的用户基于AD的,因此修改密码是 ...
随机推荐
- [C] C语言中的布尔值
C不具备显示的布尔类型,所以使用整数来代替,规则是:零是假,任何非零值皆为真. 反过来说,如果逻辑表达式为真其值一定为真,若逻辑表达式为假其值一定为零.
- storm坑之---同步问题
最近在做一个监控系统,用来监控网站上各个业务功能的调用量以及处理时间,以便及时发现问题,及时处理.做这种实时统计处理系统,自然首先想到了storm,于是现学现用,自然遇到了一些坑,而且不少是网上也难以 ...
- Windows Azure HandBook (3) 浅谈Azure安全性
<Windows Azure Platform 系列文章目录> 2015年3月5日-6日,参加了上海的Azure University活动.作为桌长与微软合作伙伴交流了Azure相关的技术 ...
- 语义化HTML:ul、ol和dl
一.语义化元素 1. ul标签 W3C草案: The ul element represents an unordered list of items; that is, a list in wh ...
- C++二维码相关库编译
一.瞎想 坐在地铁上闲来无聊,突然想到了二维码,顺手就百度了下相关的资料,目前C++二维码相关的库不多,也就zbar(开源中国上下了半天也没下载下来).zxing,不过这两个库据说都是解析二维码的,不 ...
- Linux - 修复Ubuntu错误“System program problem detected”
The error "System program problem detected" comes up when a certain application crashes. U ...
- Emit学习(2) - IL - 值类型和引用类型(补)
上周末回家去享受生活了, 工作是为了更好的生活嘛, 所以我把生活, 工作分的比较开. 这几天不是很忙, 在学习工作技能的同时, 发点博文, 也算是做一个学习笔记 上篇中, 贴出的地址里面那位哥, 也有 ...
- C#DbHelperOleDb,Access数据库帮助类
/// <summary> /// 编 码 人:苏飞 /// 联系方式:361983679 /// 更新网站:[url=http://www.sufeinet.com/thread-655 ...
- Castle ActiveRecord框架学习(二):快速搭建简单博客网站
一.数据库 1.数据表 Category:类别标签表(字段Type=1为类别,Type=2为标签) Category_Post:类别标签与文章中间表 Post:文章表 Comment:评论表 2.数据 ...
- Mysql 大小写问题
今天发布程序的时候,日志报错找不到表,但是系统中已经存在表,最后发现是sql大小写的问题,mysql默认设置导致这些执行失败. 1.用ROOT登录,修改/etc/my.cnf 2.在[mysqld]下 ...