def clean_confirm_password(self): new_password = self.cleaned_data.get("new_password") confirm_password = utils.clean_password(self.cleaned_data.get("confirm_password")) if new_password and confirm_password: if new_password != confirm_password: raise forms.ValidationError("Your passwords don't match.") return confirm_password
def clean_verify_password(self): password = self.cleaned_data.get("password") verify_password = clean_password(self.cleaned_data.get("verify_password")) if password and verify_password: if password != verify_password: raise forms.ValidationError("Your passwords don't match.") return verify_password
def change_krb_password(user_account, new_password): """"Change a user's Kerberos password. Runs a kadmin command in a pexpect session to change a user's password. Args: user_account: a dirty string of a user's OCF account new_password: a dirty string of a user's new password Returns: True if successful Raises: Exception: kadmin returned an error. Probably incorrect principal or error with sending the new password. pexpect.TIMEOUT: We never got the line that we were expecting, so something probably went wrong with the lines that we sent. pexpect.EOF: The child ended prematurely. """ user_account = clean_user_account(user_account) new_password = clean_password(new_password) cmd = _kadmin_command(user_account) child = pexpect.spawn(cmd, timeout=10) child.expect("*****@*****.**'s Password:"******"Verifying - %[email protected]'s Password:"******"kadmin" in child.before: raise Exception("kadmin Error: %s" % child.before) return True
def clean_new_password(self): data = self.cleaned_data.get("new_password") return utils.clean_password(data)
def clean_password(self): data = self.cleaned_data.get("password") return clean_password(data)