Rev 7148 | Rev 15324 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7148 | Rev 14332 | ||
---|---|---|---|
Line 7... | Line 7... | ||
7 | wims_helper=chapter=3 |
7 | wims_helper=chapter=3 |
8 | 8 | ||
9 | !read tabletheme |
9 | !read tabletheme |
10 | 10 | ||
11 | !if $wims_user!=supervisor |
11 | !if $wims_user!=supervisor |
12 | !bound job within user,none default none |
12 | !bound job within user,none default none |
13 | !else |
13 | !else |
14 | !bound job within class,user,part,none default none |
14 | !bound job within class,user,part,none default none |
15 | !endif |
15 | !endif |
16 | 16 | ||
17 | !defread wimshome/log/classes/$wims_class/.def |
17 | !defread wimshome/log/classes/$wims_class/.def |
18 | !if $class_expiration=$empty |
18 | !if $class_expiration=$empty |
19 | error=bad_class |
19 | error=bad_class |
20 | !exit |
20 | !exit |
21 | !endif |
21 | !endif |
22 | 22 | ||
23 | part=!trim $part |
23 | part=!trim $part |
24 | !if $part=$empty and $job=part |
24 | !if $part=$empty and $job=part |
25 | job=none |
25 | job=none |
26 | !endif |
26 | !endif |
27 | 27 | ||
28 | pw1=!items2words $pw1 |
28 | pw1=!items2words $pw1 |
29 | pw2=!items2words $pw2 |
29 | pw2=!items2words $pw2 |
30 | pw1=!trim $pw1 |
30 | pw1=!trim $pw1 |
31 | pw2=!trim $pw2 |
31 | pw2=!trim $pw2 |
32 | pw1=!singlespace $pw1 |
32 | pw1=!singlespace $pw1 |
33 | pw2=!singlespace $pw2 |
33 | pw2=!singlespace $pw2 |
34 | 34 | ||
35 | !if $job=none or ($old=$empty and $job notwordof class part) or\ |
35 | !if $job=none or ($old=$empty and $job notwordof class part) or\ |
36 | ($pw1=$empty or $pw2=$empty) |
36 | ($pw1=$empty or $pw2=$empty) |
37 | !exit |
37 | !exit |
38 | !endif |
38 | !endif |
39 | 39 | ||
40 | !if $pw1!=$pw2 |
40 | !if $pw1!=$pw2 |
41 | error=discord |
41 | error=discord |
42 | !exit |
42 | !exit |
43 | !endif |
43 | !endif |
44 | 44 | ||
45 | pw=!char 1 of $pw1 |
45 | pw=!char 1 of $pw1 |
46 | !if $pw=+ and $job=user |
46 | !if $pw=+ and $job=user |
47 | pw1=!char 2 to -1 of $pw1 |
47 | pw1=!char 2 to -1 of $pw1 |
48 | pw1=!trim $pw1 |
48 | pw1=!trim $pw1 |
49 | once=true |
49 | once=true |
50 | !endif |
50 | !endif |
51 | t=!wordcnt $pw1 |
51 | t=!wordcnt $pw1 |
52 | !if $t>1 and $job!=user |
52 | !if $t>1 and $job!=user |
53 | error=bad_pass |
53 | error=bad_pass |
54 | !exit |
54 | !exit |
55 | !endif |
55 | !endif |
56 | 56 | ||
57 | n=!charcnt $pw1 |
57 | n=!charcnt $pw1 |
58 | !if $n>$max_addition |
58 | !if $n>$max_addition |
59 | error=too_long |
- | |
60 | !exit |
- | |
61 | !endif |
- | |
62 | !for i=1 to $t |
- | |
63 | pw=!word $i of $pw1 |
- | |
64 | n=!charcnt $pw |
- | |
65 | !if $n>$passwd_max |
- | |
66 | error=too_long |
59 | error=too_long |
67 | !exit |
60 | !exit |
- | 61 | !endif |
|
- | 62 | !for i=1 to $t |
|
- | 63 | pw=!word $i of $pw1 |
|
- | 64 | n=!charcnt $pw |
|
- | 65 | !if $n>$passwd_max |
|
- | 66 | error=too_long |
|
- | 67 | !exit |
|
68 | !endif |
68 | !endif |
69 | !if $n>0 and $n<$passwd_min |
69 | !if $n>0 and $n<$passwd_min |
70 | error=too_short |
70 | error=too_short |
71 | !exit |
71 | !exit |
72 | !endif |
72 | !endif |
73 | !if $once!=true and $pw=$old |
73 | !if $once!=true and $pw=$old |
74 | error=nothing_to_do |
74 | error=nothing_to_do |
75 | !exit |
75 | !exit |
76 | !endif |
76 | !endif |
77 | test=!text select $char_passwd in $pw |
77 | test=!text select $char_passwd in $pw |
78 | !if $test!=$pw |
78 | !if $test!=$pw |
79 | error=bad_pass |
79 | error=bad_pass |
80 | !exit |
80 | !exit |
81 | !endif |
81 | !endif |
82 | !next i |
82 | !next i |
83 | 83 | ||
84 | !if $job=part |
84 | !if $job=part |
85 | !read adm/class/userdef classes,$wims_class,$part |
85 | !read adm/class/userdef classes,$wims_class,$part |
86 | !defread $userdef |
86 | !defread $userdef |
87 | !if $user_exists!=yes |
87 | !if $user_exists!=yes |
88 | error=bad_user |
88 | error=bad_user |
- | 89 | !exit |
|
- | 90 | !endif |
|
- | 91 | pw1=!passcrypt $pw1 |
|
- | 92 | !setdef !set user_password=$pw1 in $userdef |
|
- | 93 | pass=!getdef user_password in $userdef |
|
- | 94 | !if $pass=$pw1 |
|
- | 95 | error=success |
|
- | 96 | wims_module_log=Change participant password: $part by $wims_realuser in $wims_class |
|
- | 97 | wims_class_log=change password: $part by $wims_realuser |
|
- | 98 | !else |
|
- | 99 | error=fail |
|
- | 100 | !endif |
|
- | 101 | !exit |
|
- | 102 | !endif |
|
- | 103 | ||
- | 104 | !if $job=user |
|
- | 105 | !read adm/class/userdef classes,$wims_class,$wims_user |
|
- | 106 | !if $wims_user=supervisor |
|
- | 107 | !read var.auth |
|
- | 108 | !if $error!=$empty |
|
- | 109 | !exit |
|
- | 110 | !endif |
|
- | 111 | !endif |
|
- | 112 | !defread $userdef |
|
- | 113 | anc=!word 1 of $user_password |
|
- | 114 | anc=!passcrypt $anc |
|
- | 115 | old=!passcrypt $old |
|
- | 116 | !if $old!=$anc |
|
- | 117 | error=bad_user_password |
|
- | 118 | !exit |
|
- | 119 | !endif |
|
- | 120 | !if $once=true |
|
- | 121 | pw1=$anc $pw1 |
|
- | 122 | !endif |
|
- | 123 | pw1=!passcrypt $pw1 |
|
- | 124 | !setdef !set user_password=$pw1 in $userdef |
|
- | 125 | pass=!getdef user_password in $userdef |
|
- | 126 | !if $pass=$pw1 |
|
- | 127 | error=success |
|
- | 128 | wims_module_log=Change user password: $wims_user $wims_realuser in $wims_class |
|
- | 129 | !if $wims_user=supervisor |
|
- | 130 | wims_class_log=change password by $wims_realuser |
|
- | 131 | !read lang/mail.proc.$moduclass_lang |
|
- | 132 | !endif |
|
- | 133 | !else |
|
- | 134 | error=fail |
|
- | 135 | !endif |
|
89 | !exit |
136 | !exit |
90 | !endif |
- | |
91 | pw1=!passcrypt $pw1 |
- | |
92 | !setdef !set user_password=$pw1 in $userdef |
- | |
93 | pass=!getdef user_password in $userdef |
- | |
94 | !if $pass=$pw1 |
- | |
95 | error=success |
- | |
96 | wims_module_log=Change participant password: $part by $wims_realuser in $wims_class |
- | |
97 | wims_class_log=change password: $part by $wims_realuser |
- | |
98 | !else |
- | |
99 | error=fail |
- | |
100 | !endif |
- | |
101 | !exit |
- | |
102 | !endif |
137 | !endif |
103 | 138 | ||
104 | !if |
139 | !if $job=class |
105 |
|
140 | !if $wims_user!=supervisor |
106 |
|
141 | error=not_supervisor |
- | 142 | !exit |
|
- | 143 | !endif |
|
107 | !read var.auth |
144 | !read var.auth |
108 | !if $error!=$empty |
145 | !if $error!=$empty |
109 | !exit |
146 | !exit |
110 | !endif |
147 | !endif |
111 | !endif |
- | |
112 | !defread $userdef |
- | |
113 | anc=!word 1 of $user_password |
- | |
114 | anc=!passcrypt $anc |
- | |
115 | old=!passcrypt $old |
- | |
116 | !if $old!=$anc |
- | |
117 | error=bad_user_password |
- | |
118 | !exit |
- | |
119 | !endif |
- | |
120 | !if $once=true |
- | |
121 | pw1=$anc $pw1 |
- | |
122 | !endif |
- | |
123 | pw1=!passcrypt $pw1 |
- | |
124 | !setdef !set |
148 | !setdef !set class_password=$pw1 in wimshome/log/classes/$wims_class/.def |
125 |
|
149 | class_pass=!getdef class_password in wimshome/log/classes/$wims_class/.def |
126 | !if |
150 | !if $class_pass=$pw1 |
127 | error=success |
151 | error=success |
128 | wims_module_log=Change |
152 | wims_module_log=Change class password $wims_class by $wims_realuser in $wims_class. |
129 | !if $wims_user=supervisor |
- | |
130 | wims_class_log=change password by $wims_realuser |
153 | wims_class_log=change class password by $wims_realuser |
- | 154 | !else |
|
131 |
|
155 | error=fail |
132 | !endif |
156 | !endif |
133 | !else |
- | |
134 | error=fail |
- | |
135 | !endif |
- | |
136 | !exit |
- | |
137 | !endif |
157 | !endif |
138 | - | ||
139 | !if $job=class |
- | |
140 | !if $wims_user!=supervisor |
- | |
141 | error=not_supervisor |
- | |
142 | !exit |
- | |
143 | !endif |
- | |
144 | !read var.auth |
- | |
145 | !if $error!=$empty |
- | |
146 | !exit |
- | |
147 | !endif |
- | |
148 | !setdef !set class_password=$pw1 in wimshome/log/classes/$wims_class/.def |
- | |
149 | class_pass=!getdef class_password in wimshome/log/classes/$wims_class/.def |
- | |
150 | !if $class_pass=$pw1 |
- | |
151 | error=success |
- | |
152 | wims_module_log=Change class password $wims_class by $wims_realuser in $wims_class. |
- | |
153 | wims_class_log=change class password by $wims_realuser |
- | |
154 | !else |
- | |
155 | error=fail |
- | |
156 | !endif |
- | |
157 | !endif |
- | |
158 | - |