Rev 7144 | Rev 14332 | 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 |
12 | !bound job within user,none default none |
||
13 | !else |
||
14 | !bound job within class,user,part,none default none |
||
15 | !endif |
||
16 | |||
17 | !defread wimshome/log/classes/$wims_class/.def |
||
18 | !if $class_expiration=$empty |
||
19 | error=bad_class |
||
20 | !exit |
||
21 | !endif |
||
22 | |||
23 | part=!trim $part |
||
24 | !if $part=$empty and $job=part |
||
25 | job=none |
||
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\ |
||
36 | ($pw1=$empty or $pw2=$empty) |
||
37 | !exit |
||
38 | !endif |
||
39 | |||
40 | !if $pw1!=$pw2 |
||
41 | error=discord |
||
42 | !exit |
||
43 | !endif |
||
44 | |||
45 | pw=!char 1 of $pw1 |
||
46 | !if $pw=+ and $job=user |
||
47 | pw1=!char 2 to -1 of $pw1 |
||
48 | pw1=!trim $pw1 |
||
49 | once=true |
||
50 | !endif |
||
51 | t=!wordcnt $pw1 |
||
52 | !if $t>1 and $job!=user |
||
53 | error=bad_pass |
||
54 | !exit |
||
55 | !endif |
||
56 | |||
57 | n=!charcnt $pw1 |
||
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 |
||
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 |
||
82 | !next i |
||
83 | |||
84 | !if $job=part |
||
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 |
||
95 | error=success |
||
7148 | bpr | 96 | wims_module_log=Change participant password: $part by $wims_realuser in $wims_class |
4598 | bpr | 97 | wims_class_log=change password: $part by $wims_realuser |
23 | reyssat | 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 |
||
7144 | bpr | 112 | !defread $userdef |
23 | reyssat | 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 |
||
7148 | bpr | 128 | wims_module_log=Change user password: $wims_user $wims_realuser in $wims_class |
23 | reyssat | 129 | !if $wims_user=supervisor |
4598 | bpr | 130 | wims_class_log=change password by $wims_realuser |
2191 | bpr | 131 | !read lang/mail.proc.$moduclass_lang |
23 | reyssat | 132 | !endif |
133 | !else |
||
134 | error=fail |
||
135 | !endif |
||
136 | !exit |
||
137 | !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 |
||
7148 | bpr | 152 | wims_module_log=Change class password $wims_class by $wims_realuser in $wims_class. |
4598 | bpr | 153 | wims_class_log=change class password by $wims_realuser |
23 | reyssat | 154 | !else |
155 | error=fail |
||
156 | !endif |
||
157 | !endif |
||
158 |