mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Password changes:
- remove password generator button - add confirm password field
This commit is contained in:
parent
450e2661d5
commit
c821699b64
@ -197,7 +197,7 @@ class Root(controllers.RootController):
|
||||
def userindex(self):
|
||||
raise turbogears.redirect("/userlist")
|
||||
|
||||
@expose()
|
||||
# @expose()
|
||||
def generate_password(self):
|
||||
password = ""
|
||||
generator = random.SystemRandom()
|
||||
|
@ -3,7 +3,9 @@ from turbogears import validators, widgets
|
||||
|
||||
class UserFields():
|
||||
uid = widgets.TextField(name="uid", label="Login")
|
||||
userpassword = widgets.TextField(name="userpassword", label="Password")
|
||||
userpassword = widgets.PasswordField(name="userpassword", label="Password")
|
||||
userpassword_confirm = widgets.PasswordField(name="userpassword_confirm",
|
||||
label="Confirm Password")
|
||||
uidnumber = widgets.TextField(name="uidnumber", label="UID")
|
||||
gidnumber = widgets.TextField(name="gidnumber", label="GID")
|
||||
givenname = widgets.TextField(name="givenname", label="First name")
|
||||
@ -15,14 +17,6 @@ class UserFields():
|
||||
label="Account Status",
|
||||
options = [("", "active"), ("true", "inactive")])
|
||||
|
||||
uid.validator = validators.PlainText(not_empty=True)
|
||||
userpassword.validator = validators.String(not_empty=True)
|
||||
givenname.validator = validators.String(not_empty=True)
|
||||
sn.validator = validators.String(not_empty=True)
|
||||
mail.validator = validators.Email(not_empty=True)
|
||||
# validators.PhoneNumber may be a bit too picky, requiring an area code
|
||||
telephonenumber.validator = validators.PlainText(not_empty=True)
|
||||
|
||||
uid_hidden = widgets.HiddenField(name="uid")
|
||||
uidnumber_hidden = widgets.HiddenField(name="uidnumber")
|
||||
gidnumber_hidden = widgets.HiddenField(name="gidnumber")
|
||||
@ -30,6 +24,20 @@ class UserFields():
|
||||
|
||||
user_orig = widgets.HiddenField(name="user_orig")
|
||||
|
||||
class UserNewValidator(validators.Schema):
|
||||
uid = validators.PlainText(not_empty=True)
|
||||
userpassword = validators.String(not_empty=True)
|
||||
userpassword_confirm = validators.String(not_empty=True)
|
||||
givenname = validators.String(not_empty=True)
|
||||
sn = validators.String(not_empty=True)
|
||||
mail = validators.Email(not_empty=True)
|
||||
# validators.PhoneNumber may be a bit too picky, requiring an area code
|
||||
# telephonenumber = validators.PlainText(not_empty=False)
|
||||
|
||||
chained_validators = [
|
||||
validators.FieldsMatch('userpassword', 'userpassword_confirm')
|
||||
]
|
||||
|
||||
|
||||
class UserNewForm(widgets.Form):
|
||||
params = ['user']
|
||||
@ -38,6 +46,8 @@ class UserNewForm(widgets.Form):
|
||||
UserFields.uidnumber, UserFields.gidnumber,
|
||||
UserFields.sn, UserFields.mail]
|
||||
|
||||
validator = UserNewValidator()
|
||||
|
||||
def __init__(self, *args, **kw):
|
||||
super(UserNewForm,self).__init__(*args, **kw)
|
||||
(self.template_c, self.template) = widgets.meta.load_kid_template("ipagui.templates.usernewform")
|
||||
@ -50,6 +60,18 @@ class UserNewForm(widgets.Form):
|
||||
def has_foo(self):
|
||||
return False
|
||||
|
||||
class UserEditValidator(validators.Schema):
|
||||
userpassword = validators.String(not_empty=False)
|
||||
userpassword_confirm = validators.String(not_empty=False)
|
||||
givenname = validators.String(not_empty=True)
|
||||
sn = validators.String(not_empty=True)
|
||||
mail = validators.Email(not_empty=True)
|
||||
# validators.PhoneNumber may be a bit too picky, requiring an area code
|
||||
# telephonenumber = validators.PlainText(not_empty=False)
|
||||
|
||||
chained_validators = [
|
||||
validators.FieldsMatch('userpassword', 'userpassword_confirm')
|
||||
]
|
||||
|
||||
class UserEditForm(widgets.Form):
|
||||
params = ['user']
|
||||
@ -60,6 +82,8 @@ class UserEditForm(widgets.Form):
|
||||
UserFields.krbPasswordExpiration_hidden,
|
||||
]
|
||||
|
||||
validator = UserEditValidator()
|
||||
|
||||
def __init__(self, *args, **kw):
|
||||
super(UserEditForm,self).__init__(*args, **kw)
|
||||
(self.template_c, self.template) = widgets.meta.load_kid_template("ipagui.templates.usereditform")
|
||||
|
@ -31,6 +31,7 @@ body {
|
||||
|
||||
#header #headerinfo {
|
||||
text-align:right;
|
||||
padding-right:10px;
|
||||
}
|
||||
|
||||
#header #headerinfo #login {
|
||||
|
@ -56,8 +56,9 @@
|
||||
<span py:replace="user.userpassword.display(value_for(user.userpassword))" />
|
||||
<span py:if="tg.errors.get('userpassword')" class="fielderror"
|
||||
py:content="tg.errors.get('userpassword')" />
|
||||
<span id="password_text">********</span>
|
||||
|
||||
<!--
|
||||
<span id="password_text">********</span>
|
||||
<input id="genpassword_button" type="button" value="Generate Password"
|
||||
disabled="true"
|
||||
onclick="new Ajax.Request('${tg.url('/generate_password')}',
|
||||
@ -89,6 +90,20 @@
|
||||
}
|
||||
}
|
||||
</script>
|
||||
-->
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th valign="top">
|
||||
<label class="fieldlabel" for="${user.userpassword_confirm.field_id}"
|
||||
py:content="user.userpassword_confirm.label" />:
|
||||
</th>
|
||||
<td valign="top">
|
||||
<span py:replace="user.userpassword_confirm.display(
|
||||
value_for(user.userpassword_confirm))" />
|
||||
<span py:if="tg.errors.get('userpassword_confirm')" class="fielderror"
|
||||
py:content="tg.errors.get('userpassword_confirm')" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
@ -92,6 +92,7 @@
|
||||
<span py:if="tg.errors.get('userpassword')" class="fielderror"
|
||||
py:content="tg.errors.get('userpassword')" />
|
||||
|
||||
<!--
|
||||
<input type="button" value="Generate Password"
|
||||
onclick="new Ajax.Request('${tg.url('/generate_password')}',
|
||||
{
|
||||
@ -101,6 +102,20 @@
|
||||
transport.responseText;
|
||||
}
|
||||
});" />
|
||||
-->
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>
|
||||
<label class="fieldlabel" for="${user.userpassword_confirm.field_id}"
|
||||
py:content="user.userpassword_confirm.label" />:
|
||||
</th>
|
||||
<td>
|
||||
<span py:replace="user.userpassword_confirm.display(
|
||||
value_for(user.userpassword_confirm))" />
|
||||
<span py:if="tg.errors.get('userpassword_confirm')" class="fielderror"
|
||||
py:content="tg.errors.get('userpassword_confirm')" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user