Commits

Sachirou Inoue  committed b9e25dd

Change self password.

  • Participants
  • Parent commits c396b86

Comments (0)

Files changed (5)

File UserControl/style/style.min.css

-body{font-family:sans;font-size:10pt}form .error{box-shadow:1px 1px 2px black, 2px 2px 3px black !important;color:red;display:block !important;line-height:1.2em}#header{background:black;background:-webkit-gradient(linear, left top, left bottom, from(#000), to(#666));background:-moz-linear-gradient(top, #000, #666);background:-o-linear-gradient(top, #000, #666);background:linear-gradient(top, #000, #666);color:white;font-size:20px;line-height:50px;left:0;height:50px;position:fixed;text-align:center;top:0;width:100%;z-index:1000}#LabelNotification{background:-webkit-gradient(linear, left top, left bottom, from(#6cf), to(#28a));background:-moz-linear-gradient(top, #6cf, #28a);background:-o-linear-gradient(top, #6cf, #28a);background:linear-gradient(top, #6cf, #28a);background:#6cf;border-radius:6px;box-shadow:0 -1px 2px #fff;display:none;height:18px;left:50%;line-height:18px;margin-left:-400px;position:fixed;text-align:center;width:800px;z-index:1001}#main{position:relative;top:50px}#footer{clear:both;font-size:smaller;bottom:0;border-top:solid 1px gray;margin:10px;padding:10px;position:relative;text-align:right}#loginForm{box-shadow:0 0 1px black, 1px 1px 2px black;height:300px;margin:10px auto 0 auto;padding:10px;position:relative;width:400px}#loginForm .loginFormItem{clear:both;height:2em;width:100%}#loginForm .loginFormItem .loginFormItemName{float:left;width:4em}#loginForm .loginFormItem .loginFormItemInput{float:left}#loginForm #ButtonLogin{bottom:10px;clear:both;position:absolute;right:10px}#usersView{border-collapse:collapse;margin:0 auto;position:relative;width:800px}#usersView tr{height:18px}#usersView th,#usersView td{height:100%;line-height:18px;padding:0}#usersView td{border-top:1px solid #ccc}#usersView th:nth-child(2n-1),#usersView td:nth-child(2n-1){background:#cff}#usersView .usersViewOrder{color:black;text-decoration:none}#usersView .usersViewOrder:hover,#usersView .usersViewOrder:focus{color:#33f}#usersView .usersViewOrder:active{color:#f33}#usersViewSearch,#usersViewAdd{margin:10px auto;width:800px}#LabelPageNumbers{display:block;margin:10px auto 0 auto;position:relative;width:800px}#LabelPageNumbers .pageNumber{box-shadow:0 0 1px black;display:block;float:left;height:18px;line-height:18px;margin:3px;position:relative;text-align:center;width:18px}#LabelPageNumbers a.pageNumber{color:black;text-decoration:none}#LabelPageNumbers a.pageNumber:hover,#LabelPageNumbers a.pageNumber:focus{background:#ccc}#LabelPageNumbers a.pageNumber:active{background:#fcc}#LabelPageNumbers .currentPageNumber{background:#6cf}#userForm{box-shadow:0 0 1px black, 1px 1px 2px black;height:400px;margin:10px auto 0 auto;padding:10px;position:relative;width:600px}#userForm .userFormItem{clear:both;height:2em;margin:10px 0;width:100%}#userForm .userFormItem .userFormItemName{float:left;width:4em}#userForm .userFormItem .userFormItemInput{float:left}#userForm .userFormItem .userFormItemInput input{width:20em}#userForm #ButtonUserForm{bottom:10px;clear:both;position:absolute;right:10px}
+body{font-family:sans;font-size:10pt}form .error{box-shadow:1px 1px 2px black, 2px 2px 3px black !important;color:red;display:block !important;line-height:1.2em}#header{background:black;background:-webkit-gradient(linear, left top, left bottom, from(#000), to(#666));background:-moz-linear-gradient(top, #000, #666);background:-o-linear-gradient(top, #000, #666);background:linear-gradient(top, #000, #666);color:white;font-size:20px;line-height:50px;left:0;height:50px;position:fixed;text-align:center;top:0;width:100%;z-index:1000}#LabelNotification{background:-webkit-gradient(linear, left top, left bottom, from(#6cf), to(#28a));background:-moz-linear-gradient(top, #6cf, #28a);background:-o-linear-gradient(top, #6cf, #28a);background:linear-gradient(top, #6cf, #28a);background:#6cf;border-radius:6px;box-shadow:0 -1px 2px #fff;display:none;height:18px;left:50%;line-height:18px;margin-left:-400px;position:fixed;text-align:center;width:800px;z-index:1001}#main{position:relative;top:50px}#footer{clear:both;font-size:smaller;bottom:0;border-top:solid 1px gray;margin:10px;padding:10px;position:relative;text-align:right}#loginForm{box-shadow:0 0 1px black, 1px 1px 2px black;height:300px;margin:10px auto 0 auto;padding:10px;position:relative;width:400px}#loginForm .loginFormItem{clear:both;height:2em;width:100%}#loginForm .loginFormItem .loginFormItemName{float:left;width:4em}#loginForm .loginFormItem .loginFormItemInput{float:left}#loginForm #ButtonLogin{bottom:10px;clear:both;position:absolute;right:10px}#usersView{border-collapse:collapse;margin:0 auto;position:relative;width:800px}#usersView tr{height:18px}#usersView th,#usersView td{height:100%;line-height:18px;padding:0}#usersView td{border-top:1px solid #ccc}#usersView th:nth-child(2n-1),#usersView td:nth-child(2n-1){background:#cff}#usersView .usersViewOrder{color:black;text-decoration:none}#usersView .usersViewOrder:hover,#usersView .usersViewOrder:focus{color:#33f}#usersView .usersViewOrder:active{color:#f33}#usersViewSearch,#usersViewAdd{margin:10px auto;width:800px}#LabelPageNumbers{display:block;margin:10px auto 0 auto;position:relative;width:800px}#LabelPageNumbers .pageNumber{box-shadow:0 0 1px black;display:block;float:left;height:18px;line-height:18px;margin:3px;position:relative;text-align:center;width:18px}#LabelPageNumbers a.pageNumber{color:black;text-decoration:none}#LabelPageNumbers a.pageNumber:hover,#LabelPageNumbers a.pageNumber:focus{background:#ccc}#LabelPageNumbers a.pageNumber:active{background:#fcc}#LabelPageNumbers .currentPageNumber{background:#6cf}#userForm{box-shadow:0 0 1px black, 1px 1px 2px black;height:400px;margin:10px auto 0 auto;padding:10px;position:relative;width:600px}#userForm .userFormItem{clear:both;height:2em;margin:10px 0;width:100%}#userForm .userFormItem .userFormItemName{float:left;width:4em}#userForm .userFormItem .userFormItemInput{float:left}#userForm .userFormItem .userFormItemInput input{margin-bottom:5px;width:20em}#userForm #ButtonUserForm{bottom:10px;clear:both;position:absolute;right:10px}

File UserControl/style/userForm.scss

     .userFormItemInput {
       float: left;
 
-      input { width: 20em; }
+      input {
+        margin-bottom: 5px;
+        width: 20em;
+      }
     }
   }
 

File UserControl/update.aspx

                                 onclick="LinkButtonResetPassword_Click">Reset Password</asp:LinkButton>
                         </asp:View>
                         <asp:View ID="ViewPassMine" runat="server">
-                            <asp:TextBox ID="TextBoxPass" runat="server"></asp:TextBox>
+                            <div>
+                                現在のパスワード
+                                <asp:TextBox ID="TextBoxCurrentPass" runat="server" TextMode="Password"></asp:TextBox>
+                            </div>
+                            <div>
+                                新しいパスワード
+                                <asp:TextBox ID="TextBoxPass" runat="server"></asp:TextBox>
+                            </div>
                         </asp:View>
                     </asp:MultiView>
                 </div>
                 <asp:RegularExpressionValidator ID="RegularExpressionValidatorName" 
                     runat="server" ErrorMessage="名前の書式が違います。" ControlToValidate="TextBoxName" 
                     ValidationExpression=".{1,20}" CssClass="error"></asp:RegularExpressionValidator>
-                <asp:RequiredFieldValidator ID="RequiredFieldValidatorPass" runat="server" 
-                    ErrorMessage="パスワードは必須です。" ControlToValidate="TextBoxPass" 
-                    CssClass="error" Enabled="False"></asp:RequiredFieldValidator>
                 <asp:RegularExpressionValidator ID="RegularExpressionValidatorPass" 
-                    runat="server" ErrorMessage="パスワードの書式が違います。" 
+                    runat="server" ErrorMessage="新しいパスワードの書式が違います。" 
                     ControlToValidate="TextBoxPass" CssClass="error" 
                     ValidationExpression="[A-Za-z0-9]{1,3}" Enabled="False"></asp:RegularExpressionValidator>
                 <asp:RegularExpressionValidator ID="RegularExpressionValidatorAge" 

File UserControl/update.aspx.cs

 
         protected void Page_Load(object sender, EventArgs e)
         {
-            if (new Login(Session).LoginID == null) Response.Redirect(Login.LoginUrl);
+            string loginID = new Login(Session).LoginID;
+            if (loginID == null) Response.Redirect(Login.LoginUrl);
 
             if (TargetUser == null) Response.Redirect(MainPageUrl);
             if (!IsPostBack)
             {
+                if (TargetUser.ID == loginID)
+                {
+                    MultiViewPass.SetActiveView(ViewPassMine);
+                    RegularExpressionValidatorPass.Enabled = true;
+                }
+                else MultiViewPass.SetActiveView(ViewpassOther);
                 LabelUserID.Text = HttpUtility.HtmlEncode(TargetUser.ID);
                 TextBoxName.Text = TargetUser.Name;
                 TextBoxAge.Text = TargetUser.Age.ToString();
             {
                 TargetUser.Name = TextBoxName.Text;
                 TargetUser.Age = age;
-                if (!LinkButtonResetPassword.Enabled) TargetUser.ResetPass();
+                if (MultiViewPass.GetActiveView() == ViewPassMine && TextBoxPass.Text != string.Empty)
+                {
+                    if (TextBoxCurrentPass.Text != TargetUser.Pass)
+                    {
+                        ShowError("現在のパスワードが間違っています。");
+                        return;
+                    }
+                    TargetUser.Pass = TextBoxPass.Text;
+                }
+                else if (!LinkButtonResetPassword.Enabled)
+                    TargetUser.ResetPass();
             }
             catch (FormatException err)
             {

File UserControl/update.aspx.designer.cs

         protected global::System.Web.UI.WebControls.View ViewPassMine;
         
         /// <summary>
+        /// TextBoxCurrentPass コントロール。
+        /// </summary>
+        /// <remarks>
+        /// 自動生成されたフィールド。
+        /// 変更するには、フィールドの宣言をデザイナ ファイルから分離コード ファイルに移動します。
+        /// </remarks>
+        protected global::System.Web.UI.WebControls.TextBox TextBoxCurrentPass;
+        
+        /// <summary>
         /// TextBoxPass コントロール。
         /// </summary>
         /// <remarks>
         protected global::System.Web.UI.WebControls.RegularExpressionValidator RegularExpressionValidatorName;
         
         /// <summary>
-        /// RequiredFieldValidatorPass コントロール。
-        /// </summary>
-        /// <remarks>
-        /// 自動生成されたフィールド。
-        /// 変更するには、フィールドの宣言をデザイナ ファイルから分離コード ファイルに移動します。
-        /// </remarks>
-        protected global::System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidatorPass;
-        
-        /// <summary>
         /// RegularExpressionValidatorPass コントロール。
         /// </summary>
         /// <remarks>