• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tjcsl / ion / 8456403197

27 Mar 2024 05:56PM UTC coverage: 79.736% (-0.06%) from 79.792%
8456403197

Pull #1644

github

web-flow
Merge 9ff96f945 into 1657c3b55
Pull Request #1644: fix(logs): fix pagination not working with queries

2798 of 4988 branches covered (56.09%)

15779 of 19789 relevant lines covered (79.74%)

0.8 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

47.22
/intranet/apps/auth/helpers.py
1
import logging
1✔
2
import re
1✔
3

4
import pexpect
1✔
5

6
from django.conf import settings
1✔
7

8
logger = logging.getLogger(__name__)
1✔
9

10

11
def change_password(form_data):
1✔
12
    if form_data:
1!
13
        form_data["username"] = re.sub(r"\W", "", form_data["username"])
1✔
14
    if (
1!
15
        form_data
16
        and form_data["username"] == "unknown"
17
        or form_data["old_password"] is None
18
        or form_data["new_password"] is None
19
        or form_data["new_password_confirm"] is None
20
    ):
21
        return {"unable_to_set": True}
×
22
    if form_data["new_password"] != form_data["new_password_confirm"]:
1!
23
        return {"unable_to_set": True, "password_match": False}
×
24
    realm = settings.CSL_REALM
1✔
25
    errors = []
1✔
26
    try:
1✔
27
        kinit = pexpect.spawnu("/usr/bin/kpasswd {}@{}".format(form_data["username"], realm), timeout=settings.KINIT_TIMEOUT)
1✔
28
        match = kinit.expect([":", pexpect.EOF])
1✔
29
        if match == 1:
×
30
            return {"unable_to_set": True, "error": "User {} does not exist.".format(form_data["username"])}
×
31
        kinit.sendline(form_data["old_password"])
×
32
        kinit.expect([":", pexpect.EOF])
×
33
        if match == 1:
×
34
            return {"unable_to_set": True, "error": "Old password was incorrect."}
×
35
        kinit.sendline(form_data["new_password"])
×
36
        kinit.expect([":", pexpect.EOF])
×
37
        if match == 1:
×
38
            return {"unable_to_set": True}
×
39
        kinit.sendline(form_data["new_password_confirm"])
×
40
        kinit.expect(pexpect.EOF)
×
41
        kinit.close()
×
42
        exitstatus = kinit.exitstatus
×
43
    except pexpect.TIMEOUT:
1✔
44
        return {"unable_to_set": True, "errors": errors}
1✔
45
    if exitstatus == 0:
×
46
        return {"unable_to_set": False}
×
47
    return {"unable_to_set": True}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc