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